/// <summary> /// Convert an Assimp aiVector3D into a DirectX Vector2. /// </summary> /// <param name="vValue">The assimp value.</param> /// <returns>The equivilant DirectX value.</returns> public static Vector2 toDX9UV(aiVector3D vValue) { return new Vector2(vValue.x, vValue.y); }
/// <summary> /// Convert an Assimp aiVector3D into a DirectX Vector3D. /// </summary> /// <param name="vValue">The assimp value.</param> /// <param name="vOut">The DirectX value.</param> public static void toDX9(aiVector3D vValue, out Vector3 vOut) { vOut.X = vValue.x; vOut.Y = vValue.y; vOut.Z = vValue.z; }
/// <summary> /// Constructor which builds a Light object from a pointer to an aiLight structure. As a user, you should not call this by hand. /// <remarks>This will copy the data inside the structure into managed memory. It *DOES NOT* free the unmanaged memory.</remarks> /// </summary> /// <param name="aiLight*">A pointer to the face structure in the low level unmanaged wrapper.</param> internal unsafe Light(IntPtr p_aiLight) { // Unmarshal our structure into (what will be for us, some temporary) managed memory. This is naturally, automatically released when we exit the function. UnmanagedAssimp.aiLight tLight = (UnmanagedAssimp.aiLight)Marshal.PtrToStructure(p_aiLight, typeof(UnmanagedAssimp.aiLight)); // Copy over the nice, simple value types into managed memory. Value types copy the entire structure rather than just the pointer to it. this.mAngleOuterCone = tLight.mAngleOuterCone; this.mAngleInnerCone = tLight.mAngleInnerCone; this.mColorAmbient = tLight.mColorAmbient; this.mColorSpecular = tLight.mColorSpecular; this.mColorDiffuse = tLight.mColorDiffuse; this.mAttenuationQuadratic = tLight.mAttenuationQuadratic; this.mAttenuationLinear = tLight.mAttenuationLinear; this.mAttenuationConstant = tLight.mAttenuationConstant; this.mDirection = tLight.mDirection; this.mPosition = tLight.mPosition; this.eType = (LightType)tLight.mType; // Copy the properties over into our class as marshalled managed memory. // Note that with strings, prepending an empty string "" forces a copy. this.sName = "" + tLight.mName.data; }
/// <summary> /// Convert an Assimp aiVector3D into a DirectX Vector3D. /// </summary> /// <param name="vValue">The assimp value.</param> /// <param name="vOut">The DirectX value.</param> public static Vector3 toDX9(aiVector3D vValue) { return new Vector3(vValue.x, vValue.y, vValue.z); }
//UnmanagedAssimp.aiCamera* pCamera) /// <summary> /// Constructor which builds a Camera object from a pointer to an aiCamera structure. As a user, you should not call this by hand. /// <remarks>This will copy the data inside the structure into managed memory. It *DOES NOT* free the unmanaged memory.</remarks> /// </summary> /// <param name="aiCamera*">A pointer to the camera structure in the low level unmanaged wrapper.</param> internal unsafe Camera(IntPtr p_aiCamera) { // Cast the IntPtr to a pointer which contains our camera structure in the unmanaged assimp memory. // Note: This didn't work... :-( // UnmanagedAssimp.aiCamera* pCamera = (UnmanagedAssimp.aiCamera*)p_aiCamera.ToPointer(); // Unmarshal our structure into (what will be for us, some temporary) managed memory. This is naturally, automatically released when we exit the function. UnmanagedAssimp.aiCamera tCamera = (UnmanagedAssimp.aiCamera)Marshal.PtrToStructure(p_aiCamera, typeof(UnmanagedAssimp.aiCamera)); // Copy over the nice, simple value types into managed memory. Value types copy the entire structure rather than just the pointer to it. this.mHorizontalFOV = tCamera.mHorizontalFOV; this.mClipPlaneFar = tCamera.mClipPlaneFar; this.mClipPlaneNear = tCamera.mClipPlaneNear; this.mAspect = tCamera.mAspect; this.mLookAt = tCamera.mLookAt; this.mUp = tCamera.mUp; this.mPosition = tCamera.mPosition; // Copy the properties over into our class as marshalled managed memory. // Note that with strings, prepending an empty string "" forces a copy. this.mName = "" + tCamera.mName.data; }