Index: Bindings/C#/Source/Horde3D .NET/Horde3D.cs
===================================================================
--- Bindings/C#/Source/Horde3D .NET/Horde3D.cs (revision 328)
+++ Bindings/C#/Source/Horde3D .NET/Horde3D.cs (working copy)
@@ -560,6 +560,20 @@
ForceF3
}
+ ///
+ /// Enum: H3DModelUpdateFlags
+ /// The available flags for h3dUpdateModel.
+ ///
+ /// Animation - Apply animation
+ /// Geometry - Apply morphers and software skinning
+ ///
+ public enum H3DModelUpdateFlags
+ {
+ Animation = 1,
+ Geometry = 2
+ };
+
+
// --- Basic funtions ---
///
/// This function returns a string containing the current version of h3d.
@@ -1650,7 +1664,25 @@
return NativeMethodsEngine.h3dSetModelMorpher(node, target, weight);
}
+
+ ///
+ /// Applies animation and/or geometry updates.
+ ///
+ /// This function applies skeletal animation and geometry updates to the specified model, depending on
+ /// the specified update flags. Geometry updates include morph targets and software skinning if enabled.
+ /// If the animation or morpher parameters did not change, the function returns immediately. This function
+ /// has to be called so that changed animation or morpher parameters will take effect.
+ ///
+ /// handle to the Model node to be updated
+ /// combination of H3DModelUpdate flags
+ public static void updateModel(int modelNode, int flags)
+ {
+ NativeMethodsEngine.h3dUpdateModel(modelNode, flags);
+ }
+
+
+
// Mesh specific
///
/// This function creates a new Mesh node and attaches it to the specified parent node.
@@ -1771,9 +1803,9 @@
///
/// handle to the Emitter node which will be modified
/// time delta in seconds
- public static void advanceEmitterTime(int node, float timeDelta)
+ public static void updateEmitter(int node, float timeDelta)
{
- NativeMethodsEngine.h3dAdvanceEmitterTime(node, timeDelta);
+ NativeMethodsEngine.h3dUpdateEmitter(node, timeDelta);
}
///
Index: Bindings/C#/Source/Horde3D .NET/Horde3D_Import.cs
===================================================================
--- Bindings/C#/Source/Horde3D .NET/Horde3D_Import.cs (revision 328)
+++ Bindings/C#/Source/Horde3D .NET/Horde3D_Import.cs (working copy)
@@ -268,6 +268,9 @@
[return: MarshalAs(UnmanagedType.U1)] // represents C++ bool type
internal static extern bool h3dSetModelMorpher(int node, string target, float weight);
+ [DllImport(ENGINE_DLL), SuppressUnmanagedCodeSecurity]
+ internal static extern void h3dUpdateModel(int modelNode, int flags);
+
// Mesh specific
[DllImport(ENGINE_DLL), SuppressUnmanagedCodeSecurity]
internal static extern int h3dAddMeshNode(int parent, string name, int matRes,
@@ -302,8 +305,8 @@
int matRes, int effectRes,
int maxParticleCount, int respawnCount );
- [DllImport(ENGINE_DLL), SuppressUnmanagedCodeSecurity]
- internal static extern void h3dAdvanceEmitterTime(int node, float timeDelta);
+ [DllImport(ENGINE_DLL), SuppressUnmanagedCodeSecurity]
+ internal static extern void h3dUpdateEmitter(int node, float timeDelta);
[DllImport(ENGINE_DLL), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.U1)] // represents C++ bool type
Index: Samples/Chicago .NET/CrowdSim.cs
===================================================================
--- Samples/Chicago .NET/CrowdSim.cs (revision 328)
+++ Samples/Chicago .NET/CrowdSim.cs (working copy)
@@ -177,6 +177,7 @@
// Update animation
p.animTime += vel * 35.0f;
h3d.setModelAnimParams( p.node, 0, p.animTime, 1.0f );
+ h3d.updateModel(p.node, (int)(h3d.H3DModelUpdateFlags.Animation | h3d.H3DModelUpdateFlags.Geometry));
}
}
}
Index: Samples/Knight .NET/App.cs
===================================================================
--- Samples/Knight .NET/App.cs (revision 328)
+++ Samples/Knight .NET/App.cs (working copy)
@@ -152,7 +152,7 @@
public void mainLoop(float fps)
{
_curFPS = fps;
- _timer += 1 / fps;
+ _timer += 1f / fps;
h3d.setOption( h3d.H3DOptions.DebugViewMode, _debugViewMode ? 1.0f : 0.0f );
h3d.setOption( h3d.H3DOptions.WireframeMode, _wireframeMode ? 1.0f : 0.0f );
@@ -164,11 +164,12 @@
// Do animation blending
h3d.setModelAnimParams( _knight, 0, _animTime * 24.0f, _weight );
h3d.setModelAnimParams( _knight, 1, _animTime * 24.0f, 1.0f - _weight );
+ h3d.updateModel( _knight, (int)(h3d.H3DModelUpdateFlags.Animation | h3d.H3DModelUpdateFlags.Geometry ));
// Animate particle system
int cnt = cnt = h3d.findNodes(_particleSys, "", (int)h3d.H3DNodeTypes.Emitter);
for( int i = 0; i < cnt; ++i )
- h3d.advanceEmitterTime( h3d.getNodeFindResult( i ), 1.0f / _curFPS );
+ h3d.updateEmitter(h3d.getNodeFindResult(i), 1.0f / _curFPS);
}
// Set camera parameters