JRowe Posted January 17, 2010 Share Posted January 17, 2010 (edited) I'm working on a new project, integrating a 3D engine that just became available. I was wondering if anyone could take a stab at creating the following struct using DllStructCreate.struct D3DXVECTOR3 { float x,y,z; D3DXVECTOR3(float x=0.0f,float y=0.0f,float z=0.0f) { this->x = x; this->y = y; this->z = z; } D3DXVECTOR3& operator+= (const D3DXVECTOR3&); D3DXVECTOR3& operator-= (const D3DXVECTOR3&); D3DXVECTOR3& operator*= (float); D3DXVECTOR3& operator/= (float); D3DXVECTOR3 operator+ () const; D3DXVECTOR3 operator- () const; D3DXVECTOR3 operator+ (const D3DXVECTOR3&) const; D3DXVECTOR3 operator- (const D3DXVECTOR3&) const; D3DXVECTOR3 operator* (float) const; D3DXVECTOR3 operator/ (float) const; BOOL operator== (const D3DXVECTOR3&) const; BOOL operator!= (const D3DXVECTOR3&) const; };The code I'm using it in is expecting a D3DXVector3 struct to be passed as one of the parameters. Using the following, I crash the 3D engine.Func iCameraLocationSet($pCamera, $fX, $fY, $fZ) $D3DXVector3 = DllStructCreate("float X;float Y;float Z") DllStructSetData($D3DXVector3, "X", $fX) DllStructSetData($D3DXVector3, "Y", $fY) DllStructSetData($D3DXVector3, "Z", $fZ) DllCall($3iDLL, "none:cdecl", "iCameraLocationSet", "ptr", $pCamera, "ptr", $D3DXVector3) EndFuncIs there an easy way to set this up?Other reference: http://msdn.microsoft.com/en-us/library/ee417646%28VS.85%29.aspxhttp://www.3impact.com/3Impact_Engine/hulk7123/reference.htmI've gotten the engine to initialize, etc, just haven't been able to use the structs for positioning. As soon as that gets figured out, I only have around 180 or so functions left to wrap in. Any help is appreciated Edit: It appears I got ahead of myself. the function iCameraLocationSet is expecting a pointer to a valid camera object. I'd assumed that there was such a pointer being created; I was wrong. That being the case, I've gone back to figure out where the heck I went wrong, and I'll be back later. Thanks for any input, however! Edited January 17, 2010 by JRowe [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
wolf9228 Posted January 17, 2010 Share Posted January 17, 2010 I'm working on a new project, integrating a 3D engine that just became available. I was wondering if anyone could take a stab at creating the following struct using DllStructCreate. struct D3DXVECTOR3 { float x,y,z; D3DXVECTOR3(float x=0.0f,float y=0.0f,float z=0.0f) { this->x = x; this->y = y; this->z = z; } D3DXVECTOR3& operator+= (const D3DXVECTOR3&); D3DXVECTOR3& operator-= (const D3DXVECTOR3&); D3DXVECTOR3& operator*= (float); D3DXVECTOR3& operator/= (float); D3DXVECTOR3 operator+ () const; D3DXVECTOR3 operator- () const; D3DXVECTOR3 operator+ (const D3DXVECTOR3&) const; D3DXVECTOR3 operator- (const D3DXVECTOR3&) const; D3DXVECTOR3 operator* (float) const; D3DXVECTOR3 operator/ (float) const; BOOL operator== (const D3DXVECTOR3&) const; BOOL operator!= (const D3DXVECTOR3&) const; }; The code I'm using it in is expecting a D3DXVector3 struct to be passed as one of the parameters. Using the following, I crash the 3D engine. Func iCameraLocationSet($pCamera, $fX, $fY, $fZ) $D3DXVector3 = DllStructCreate("float X;float Y;float Z") DllStructSetData($D3DXVector3, "X", $fX) DllStructSetData($D3DXVector3, "Y", $fY) DllStructSetData($D3DXVector3, "Z", $fZ) DllCall($3iDLL, "none:cdecl", "iCameraLocationSet", "ptr", $pCamera, "ptr", $D3DXVector3) EndFunc Is there an easy way to set this up? Other reference: http://msdn.microsoft.com/en-us/library/ee417646%28VS.85%29.aspx http://www.3impact.com/3Impact_Engine/hulk7123/reference.htm I've gotten the engine to initialize, etc, just haven't been able to use the structs for positioning. As soon as that gets figured out, I only have around 180 or so functions left to wrap in. Any help is appreciated All of these expandcollapse popup#ifdef __cplusplus typedef struct D3DXVECTOR3 : public D3DVECTOR { public: D3DXVECTOR3() {}; D3DXVECTOR3( CONST FLOAT * ); D3DXVECTOR3( CONST D3DVECTOR& ); D3DXVECTOR3( CONST D3DXFLOAT16 * ); D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); // casting operator FLOAT* (); operator CONST FLOAT* () const; // assignment operators D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); D3DXVECTOR3& operator *= ( FLOAT ); D3DXVECTOR3& operator /= ( FLOAT ); // unary operators D3DXVECTOR3 operator + () const; D3DXVECTOR3 operator - () const; // binary operators D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; D3DXVECTOR3 operator * ( FLOAT ) const; D3DXVECTOR3 operator / ( FLOAT ) const; friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& ); BOOL operator == ( CONST D3DXVECTOR3& ) const; BOOL operator != ( CONST D3DXVECTOR3& ) const; } D3DXVECTOR3, *LPD3DXVECTOR3; #else //!__cplusplus typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; #endif //!__cplusplus C++ Operators Compared In (FLOAT x, FLOAT y, FLOAT z) Variables Operators Compared in Different Languages http://msdn.microsoft.com/en-us/library/2hxce09y%28VS.71%29.aspx صرح السماء كان هنا Link to comment Share on other sites More sharing options...
ProgAndy Posted January 17, 2010 Share Posted January 17, 2010 $D3DXVector3 = DllStructCreate("float X;float Y;float Z") this line is correct, but you have an error in your DLLCall. You forgot to call DLLStructGetPtr DLLCall(... , 'ptr', DLLStructgetPtr($D3DXVector3)) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
JRowe Posted January 17, 2010 Author Share Posted January 17, 2010 Wow, brainfart. Thanks man. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now