|
Re: C# wrapper - RELEASE 1.1.1.2
[Re: Stromausfall]
#281805
07/28/09 19:44
07/28/09 19:44
|
Joined: Dec 2006
Posts: 434 UK,Terra, SolarSystem, Milky W...
pararealist
Senior Member
|
Senior Member
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
|
Hi Stromausfall after update to ver 1.1.1.1 or ver 1.1.1.2 gets error setting camera stage. before update i had (ver 1.1.1.0)
aFXCamera.stage = (IntPtr)null;
now after update i have to cast to VIEW
aFXCamera.stage = (VIEW)(IntPtr)null;
but this crashes in
/* -------- VIEW -------- */
/* VIEW to NativeVIEW* (address in void*) */
public static explicit operator IntPtr(VIEW d)
{
unsafe
{
return (IntPtr)(NativeVIEW*)d.VIEWPointer; // CRASH HERE!
}
}
with an exception:
Last edited by pararealist; 07/28/09 19:48.
A8.3x Commercial, AcknexWrapper and VS 2010 Express ○pararealist now.
|
|
|
Re: C# wrapper - RELEASE 1.1.1.2
[Re: pararealist]
#281807
07/28/09 19:47
07/28/09 19:47
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
OP
User
Joined: Dec 2002
Posts: 616
Austria
|
ah thanks, will fix it and upload a new version, will upload in 10 mins if everyything works as planned!
You also mentioned that you have to cast to view now. But there are also other possibilities than aFXCamera.stage = (VIEW)(IntPtr)null;
for example
aFXCamera.stage = (VIEW)null;
aFXCamera.stage = null;
aFXCamera.stage = (VIEW)IntPtr.Zero;
Last edited by Stromausfall; 07/28/09 20:17.
|
|
|
Re: C# wrapper - RELEASE 1.1.1.3
[Re: Stromausfall]
#281817
07/28/09 20:25
07/28/09 20:25
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
i have looked into boo a bit the last two evenings. it kind of is c# with a python-like syntax. i could imagine that it would be quite easy to convert my python wrapper to boo with some simple converter scripts. so maybe there will be a competitor .net wrapper with automatic var handling. :p it's rather unlikely though since i don't have much time and i am pretty new to .net and all this marshaling stuff. probably unforeseen problems will arise.
|
|
|
Re: C# wrapper - RELEASE 1.1.1.3
[Re: Stromausfall]
#281826
07/28/09 21:04
07/28/09 21:04
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Has anyone any experience with runtime evaluation/ execution of strings? What i'm talking about is say you have a string >> "EngVar.sunlight.Intvalue=0" and then being able to process this at runtime, and have C# execute it. I don't think C# has an eval() function at the moment, i think python does though.
This way you could create your own scripting engine allowing the user to change almost anything at runtime.
I'll probably have to wait until C# 4.0 or even 5.0 appears. I think they are exposing the CLR compiler as a set of classes, so you can control what happens at runtime.
Last edited by DJBMASTER; 07/28/09 21:05.
|
|
|
Re: C# wrapper - RELEASE 1.1.1.3
[Re: DJBMASTER]
#281829
07/28/09 21:15
07/28/09 21:15
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
you could use ironpython for that. it's supposed to be very easy to include in a c# project. @stromausfall: thanks for offering your help. maybe i will have some questions about delegates. i don't wrap the engine in c# but in boo. doesn't make much difference though and it will be usable by all .net languages. in boo the wrapper will look kind of like that:
class Engine:
ev as ENGINE_VARS
def constructor(commandline as string):
ev = Marshal.PtrToStructure(engine_open(commandline), ENGINE_VARS)
def frame():
return engine_frame()
def close():
engine_close()
version as single:
get: return _FLOAT(Marshal.ReadInt32(ev.version))
edition as int:
get: return _INT(Marshal.ReadInt32(ev.edition))
compatibility as int:
get: return _INT(Marshal.ReadInt32(ev.compatibility))
set: Marshal.WriteInt32(ev.compatibility, _VAR(value))
...
edit: i tested using the boo wrapper from c# now. works nicely. i really like how all languages can work together automatically in .net. here is how it looks like:
using System;
using a7;
namespace test
{
class Program
{
public static void Main(string[] args)
{
Engine e = new Engine("-nwnd");
Console.WriteLine(e.version);
Vector v1 = new Vector(10, 10, 10);
Vector v2 = new Vector(30, 30, 30);
Vector v = v1 + v2;
Console.WriteLine(v);
while(e.frame() != 0)
{
}
e.close();
}
}
}
|
|
|
|