Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by 7th_zorro. 04/20/24 07:29
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, henrybane, flink, Edgar_Herrera), 758 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 13 of 23 1 2 11 12 13 14 15 22 23
Re: C# wrapper 2.2.6 - RELEASE [Re: Stromausfall] #372755
06/04/11 00:56
06/04/11 00:56
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
Hi,
How can I load a shader of the Standart material library.
Do I have to load a Script via "engine_getscript".
And how do I access the Material (not the functions) from this script.
Thank you,
Patrick

Re: C# wrapper 2.2.6 - RELEASE [Re: jenGs] #372767
06/04/11 07:52
06/04/11 07:52
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
Hi !
From what i can see, there are two types of materials in the shader library :
Predefined Materials
and
Predefined Surface Shaders

for an example of how to load a Predefined Surface Shader (a shader that uses a .fx file) follow this link to an example (there is also a download link to an example) : shader example

If you on the other hand want to assign a Predefined Material, then you only have to assign the corresponding EngVar. Here's an example :

Code:
using System;
using System.Collections.Generic;
using AcknexWrapper;

namespace ShaderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            EngFun.engine_open(null, null);

            Scheduler.StartScheduler(MyMainMethod);
        }

        private static IEnumerable<ScheduleMethod> MyMainMethod()
        {
            // load an empty level
            EngFun.level_load(null);

            // create a cube (_CUBE.mdl is a predefined model - CUBE_MDL in lite-c)
            ENTITY cube =
                ENTITY.ent_create(
                    "_CUBE.mdl",
                    new Vector(60, -20, 0),
                    CubeMethod);

            yield break;
        }

        private static IEnumerable<ScheduleMethod> CubeMethod(IntPtr p)
        {
            ENTITY cube =
                ENTITY.createFromPointer(p);

            // now assign the standard metal material
            cube.material =
                EngVar.mtl_metal;

            // change the ambient vector of the standard metal material
            EngVar.mtl_metal.ambient_red = 255;

            while (true)
            {
                // rotate the cube
                cube.pan += 2 * EngVar.time_step;
                cube.tilt += 1.5 * EngVar.time_step;

                // wait one frame
                yield return 1;
            }
        }
    }
}




Last edited by Stromausfall; 06/04/11 07:53.

get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper 2.2.6 - RELEASE [Re: Stromausfall] #372949
06/06/11 02:49
06/06/11 02:49
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
Hey, thank you for your help.

But I have another problem.

I have an embeded engine Window in a form.
Now I want to feed my Form with data from the engine thread.
Is this possible? I don't now that much about threading in csharp.

Another question: How do I pass a parameter value to a Scheduled method?

Edit: Ok, the last problem is solved. I should read your examples more carfully laugh . Is the AddEventObject method the only possible way to pass a parameter? So I guess I have to create a data structure with the information I want to pass?

Last edited by jenGs; 06/06/11 03:00.
Re: C# wrapper 2.2.6 - RELEASE [Re: jenGs] #372987
06/06/11 14:29
06/06/11 14:29
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
Hi!
yes the AddEventObject and Scheduler.AddEventObjectThreadSafe methods are the only way to pass an argument !

But passing an argument is often not necessary, because you can of course create an object fore the method, and thus store as many parameters as you want !

for example :
Code:
class SomeClass
    {
        private string storedParameter1;
        private int storedParameter2;

        public SomeClass(string parameter1, int parameter2)
        {
            this.storedParameter1 = parameter1;
            this.storedParameter2 = parameter2;

            Scheduler.AddEventVoid(SomeFun);
        }

        private IEnumerable<ScheduleMethod> SomeFun()
        {
            Console.WriteLine(storedParameter1 + storedParameter2);
            yield break;
        }
    }



There are lots and lots of different approaches to solve this ! Putting all arguments into a struct and then pass it as object parameter is most likely not the best one - because it is quite unsafe and involves casting !


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper 2.2.7 - RELEASE [Re: Stromausfall] #375054
06/23/11 12:15
06/23/11 12:15
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
a new version was uploaded (for Acknex 7.85.4 AND Acknex 8.10)
the update of the wrapper includes:

this update includes:
- the conversion between acknex Var variables/values and C# double values has been improved signifcantly ! If you now set/get the value of an engine object/variable to 9.493, it IS 9.493 in the acknex engine ! Previously a slight rounding error was always present (this showed when using a panel which displayed a number, or using pixel_ functions).
- the scheduler/acknex engine can now be closed and started again, through using the new Scheduler.CloseEngineAndScheduler method and waiting for Scheduler.EngineClosed to become true (after calling the Scheduler.CloseEngineAndScheduler method). After this the engine/scheduler is fully reset and can be started again !

here's the link:

AcknexWrapper_2_2_7_FOR_8_10_AND_7_85_4.zip


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper 2.2.8 - RELEASE [Re: Stromausfall] #375203
06/24/11 09:48
06/24/11 09:48
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
a new version was uploaded (for Acknex 7.85.4 AND Acknex 8.10)
the update of the wrapper includes:

this update includes:
- reverted ‘improved conversion’ to the old (pre 2.2.7) conversion, because the ‘new conversion’ (2.2.7) is buggy and slow
- pixel_for_vec, pixel_to_vec, pixel_for_bmap, pixel_to_bmap – internally no conversion happens anymore – the pixel value now has type ‘int’ not double (thus allows consistent read and write)

here's the link:

AcknexWrapper_2_2_8_FOR_8_10_AND_7_85_4.zip

Last edited by Stromausfall; 06/24/11 09:48.

get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper 2.2.9 - RELEASE [Re: Stromausfall] #375524
06/26/11 09:37
06/26/11 09:37
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
a new version was uploaded (for Acknex 7.85.4 AND Acknex 8.10)
the update of the wrapper includes:

this update includes:
- ScheduleMethod.executeEventVoid and ScheduleMethod.executeEventObject improved -> methods added that way, when they end, immediately jump back to the method that called them, not wait 1 frame to jump back !

here's the link:

AcknexWrapper_2_2_9_FOR_8_10_AND_7_85_4.zip


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper 2.2.9 - RELEASE [Re: Stromausfall] #375701
06/27/11 12:30
06/27/11 12:30
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline
Senior Member
pararealist  Offline
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
Hi M
Where/how have you implemented path_create
I cannot seem to find it in wrapper.


A8.3x Commercial, AcknexWrapper and VS 2010 Express
&#9675;pararealist now.
Re: C# wrapper 2.2.9 - RELEASE [Re: pararealist] #376154
06/30/11 13:09
06/30/11 13:09
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
hi !
path_create is 8.20, but the wrapper is still 8.10 ! I'll update the wrapper in the next release (1-2 weeks).


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper 2.2.9 - RELEASE [Re: Stromausfall] #376194
06/30/11 16:36
06/30/11 16:36
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline
Senior Member
pararealist  Offline
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
OK, noticed it was still 8.10 after post.


A8.3x Commercial, AcknexWrapper and VS 2010 Express
&#9675;pararealist now.
Page 13 of 23 1 2 11 12 13 14 15 22 23

Moderated by  TWO 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1