diff --git a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.NET.dll.csproj b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.NET.dll.csproj
index 22a1fa3a..c8ccaa9e 100644
--- a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.NET.dll.csproj
+++ b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.NET.dll.csproj
@@ -29,10 +29,13 @@
+
+
+
diff --git a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.cs b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.cs
index 6de5ff5f..da257522 100644
--- a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.cs
+++ b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D.cs
@@ -423,6 +423,7 @@ public enum H3DNodeParams
/// (may not be smaller than LodDist2) (default: infinite)
/// LodDist4F - Distance to camera from which on LOD4 is used
/// (may not be smaller than LodDist3) (default: infinite)
+ /// AnimCountI - Number of active animation stages [read-only]
///
public enum H3DModel
{
@@ -431,7 +432,8 @@ public enum H3DModel
LodDist1F,
LodDist2F,
LodDist3F,
- LodDist4F
+ LodDist4F,
+ AnimCountI
}
///
@@ -1650,6 +1652,21 @@ public static void setupModelAnimStage(int node, int stage, int animationRes, in
NativeMethodsEngine.h3dSetupModelAnimStage(node, stage, animationRes, layer, startNode, additive);
}
+ ///
+ /// This function gets the current animation time and weight for a specified stage of the specified model.
+ ///
+ /// The time corresponds to the frames of the animation and the animation is looped if the time is higher than the maximum number of frames in the Animation resource.
+ /// The weight is used for animation blending and determines how much influence the stage has compared to the other active stages.
+ ///
+ /// handle to the node to be accessed
+ /// index of the animation stage to be accessed
+ /// variable where the time of the animation stage will be stored
+ /// variable where the blend weight of the animation stage will be stored
+ public static void getModelAnimParams(int node, int stage, out float time, out float weight)
+ {
+ NativeMethodsEngine.h3dGetModelAnimParams(node, stage, out time, out weight);
+ }
+
///
/// This function sets the current animation time and weight for a specified stage of the specified model.
///
@@ -1863,4 +1880,4 @@ protected LibraryIncompatibleException(SerializationInfo info, StreamingContext
{
}
}
-}
\ No newline at end of file
+}
diff --git a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils.cs b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils.cs
index 70151bb4..3aa1590b 100644
--- a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils.cs
+++ b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils.cs
@@ -41,32 +41,6 @@ public static bool dumpMessages()
return NativeMethodsUtils.h3dutDumpMessages();
}
- ///
- /// This utility function initializes an OpenGL rendering context in a specified window component.
- ///
- /// handle to device context for which OpenGL context shall be created
- /// true in case of success, otherwise false
- public static bool initOpenGL(int hDC)
- {
- return NativeMethodsUtils.h3dutInitOpenGL(hDC);
- }
-
- ///
- /// This utility function destroys the previously created OpenGL rendering context.
- ///
- public static void releaseOpenGL()
- {
- NativeMethodsUtils.h3dutReleaseOpenGL();
- }
-
- ///
- /// This utility function displays the image rendered to the previously initialized OpenGL context on the screen by copying the OpenGL backbuffer to the window front buffer.
- ///
- public static void swapBuffers()
- {
- NativeMethodsUtils.h3dutSwapBuffers();
- }
-
///
/// This function returns the search path of a specified resource type.
///
@@ -266,4 +240,4 @@ public static void showFrameStats(int fontMaterialRes, int panelMaterialRes, int
NativeMethodsUtils.h3dutShowFrameStats(fontMaterialRes, panelMaterialRes, mode);
}
}
-}
\ No newline at end of file
+}
diff --git a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils_Import.cs b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils_Import.cs
index a9cd8715..f2ad0743 100644
--- a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils_Import.cs
+++ b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3DUtils_Import.cs
@@ -31,16 +31,6 @@ internal static class NativeMethodsUtils
[return: MarshalAs(UnmanagedType.U1)] // represents C++ bool type
internal static extern bool h3dutDumpMessages();
- [DllImport(UTILS_DLL), SuppressUnmanagedCodeSecurity]
- [return: MarshalAs(UnmanagedType.U1)] // represents C++ bool type
- internal static extern bool h3dutInitOpenGL(int hDC);
-
- [DllImport(UTILS_DLL), SuppressUnmanagedCodeSecurity]
- internal static extern void h3dutReleaseOpenGL();
-
- [DllImport(UTILS_DLL), SuppressUnmanagedCodeSecurity]
- internal static extern void h3dutSwapBuffers();
-
// Utilities
[DllImport(UTILS_DLL), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr h3dutGetResourcePath(h3d.H3DResTypes type);
@@ -84,4 +74,4 @@ internal static extern void h3dutShowText(string text, float x, float y, float s
internal static extern bool h3dutScreenshot(string filename);
}
-}
\ No newline at end of file
+}
diff --git a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D_Import.cs b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D_Import.cs
index 4e76a78b..86104a59 100644
--- a/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D_Import.cs
+++ b/Horde3D/Bindings/C#/Source/Horde3D .NET/Horde3D_Import.cs
@@ -264,6 +264,9 @@ internal static extern void h3dSetNodeTransform(int node, float px, float py, fl
internal static extern void h3dSetupModelAnimStage(int node, int stage, int animationRes,
int layer, string startNode, [MarshalAs(UnmanagedType.U1)]bool additive);
+ [DllImport(ENGINE_DLL), SuppressUnmanagedCodeSecurity]
+ internal static extern void h3dGetModelAnimParams(int node, int stage, out float time, out float weight);
+
[DllImport(ENGINE_DLL), SuppressUnmanagedCodeSecurity]
internal static extern void h3dSetModelAnimParams(int node, int stage, float time, float weight);
diff --git a/Horde3D/Bindings/C#/Source/Horde3D .NET/OpenGL.cs b/Horde3D/Bindings/C#/Source/Horde3D .NET/OpenGL.cs
new file mode 100644
index 00000000..27cc0ff8
--- /dev/null
+++ b/Horde3D/Bindings/C#/Source/Horde3D .NET/OpenGL.cs
@@ -0,0 +1,123 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Horde3DNET
+{
+ public class OpenGL
+ {
+ [DllImport("user32.dll")]
+ public static extern IntPtr GetDC( IntPtr hWnd);
+
+ [DllImport("opengl32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
+ public static extern IntPtr wglCreateContext(IntPtr hDC);
+
+ [DllImport("opengl32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
+ public static extern bool wglMakeCurrent(IntPtr hDC, IntPtr hglrc);
+
+ [DllImport("opengl32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
+ public static extern bool wglDeleteContext(IntPtr hglrc);
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct PIXELFORMATDESCRIPTOR
+ {
+ public void Init()
+ {
+ nSize = (ushort)Marshal.SizeOf(typeof(PIXELFORMATDESCRIPTOR));
+ nVersion = 1;
+ dwFlags = PFD_FLAGS.PFD_DRAW_TO_WINDOW | PFD_FLAGS.PFD_SUPPORT_OPENGL | PFD_FLAGS.PFD_DOUBLEBUFFER;
+ iPixelType = PFD_PIXEL_TYPE.PFD_TYPE_RGBA;
+ cColorBits = 32;
+ cRedBits = cRedShift = cGreenBits = cGreenShift = cBlueBits = cBlueShift = 0;
+ cAlphaBits = 8;
+ cAlphaShift = 0;
+ cAccumBits = cAccumRedBits = cAccumGreenBits = cAccumBlueBits = cAccumAlphaBits = 0;
+ cDepthBits = 32;
+ cStencilBits = 8;
+ cAuxBuffers = 0;
+ iLayerType = PFD_LAYER_TYPES.PFD_MAIN_PLANE;
+ bReserved = 0;
+ dwLayerMask = dwVisibleMask = dwDamageMask = 0;
+ }
+ ushort nSize;
+ ushort nVersion;
+ PFD_FLAGS dwFlags;
+ PFD_PIXEL_TYPE iPixelType;
+ byte cColorBits;
+ byte cRedBits;
+ byte cRedShift;
+ byte cGreenBits;
+ byte cGreenShift;
+ byte cBlueBits;
+ byte cBlueShift;
+ byte cAlphaBits;
+ byte cAlphaShift;
+ byte cAccumBits;
+ byte cAccumRedBits;
+ byte cAccumGreenBits;
+ byte cAccumBlueBits;
+ byte cAccumAlphaBits;
+ byte cDepthBits;
+ byte cStencilBits;
+ byte cAuxBuffers;
+ PFD_LAYER_TYPES iLayerType;
+ byte bReserved;
+ uint dwLayerMask;
+ uint dwVisibleMask;
+ uint dwDamageMask;
+ }
+
+ [Flags]
+ public enum PFD_FLAGS : uint
+ {
+ PFD_DOUBLEBUFFER = 0x00000001,
+ PFD_STEREO = 0x00000002,
+ PFD_DRAW_TO_WINDOW = 0x00000004,
+ PFD_DRAW_TO_BITMAP = 0x00000008,
+ PFD_SUPPORT_GDI = 0x00000010,
+ PFD_SUPPORT_OPENGL = 0x00000020,
+ PFD_GENERIC_FORMAT = 0x00000040,
+ PFD_NEED_PALETTE = 0x00000080,
+ PFD_NEED_SYSTEM_PALETTE = 0x00000100,
+ PFD_SWAP_EXCHANGE = 0x00000200,
+ PFD_SWAP_COPY = 0x00000400,
+ PFD_SWAP_LAYER_BUFFERS = 0x00000800,
+ PFD_GENERIC_ACCELERATED = 0x00001000,
+ PFD_SUPPORT_DIRECTDRAW = 0x00002000,
+ PFD_DIRECT3D_ACCELERATED = 0x00004000,
+ PFD_SUPPORT_COMPOSITION = 0x00008000,
+ PFD_DEPTH_DONTCARE = 0x20000000,
+ PFD_DOUBLEBUFFER_DONTCARE = 0x40000000,
+ PFD_STEREO_DONTCARE = 0x80000000
+ }
+
+ public enum PFD_LAYER_TYPES : byte
+ {
+ PFD_MAIN_PLANE = 0,
+ PFD_OVERLAY_PLANE = 1,
+ PFD_UNDERLAY_PLANE = 255
+ }
+
+ public enum PFD_PIXEL_TYPE : byte
+ {
+ PFD_TYPE_RGBA = 0,
+ PFD_TYPE_COLORINDEX = 1
+ }
+
+ [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
+ public static extern int ChoosePixelFormat(IntPtr hdc, [In] ref PIXELFORMATDESCRIPTOR ppfd);
+
+ [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
+ public static extern bool SetPixelFormat(IntPtr hdc, int iPixelFormat, ref PIXELFORMATDESCRIPTOR ppfd);
+
+ [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
+ public static extern bool SwapBuffers(IntPtr hdc);
+
+ public enum StringName : uint
+ {
+ GL_VENDOR = 0x1F00,
+ GL_RENDERER = 0x1F01,
+ GL_VERSION = 0x1F02,
+ GL_EXTENSIONS = 0x1F03
+ }
+ }
+}
diff --git a/Horde3D/Bindings/C++/Horde3D.h b/Horde3D/Bindings/C++/Horde3D.h
index bf20bc5e..90a736a6 100644
--- a/Horde3D/Bindings/C++/Horde3D.h
+++ b/Horde3D/Bindings/C++/Horde3D.h
@@ -495,6 +495,7 @@ struct H3DModel
(may not be smaller than LodDist2) (default: infinite)
LodDist4F - Distance to camera from which on LOD4 is used
(may not be smaller than LodDist3) (default: infinite)
+ AnimCountI - Number of active animation stages [read-only]
*/
enum List
{
@@ -503,7 +504,8 @@ struct H3DModel
LodDist1F,
LodDist2F,
LodDist3F,
- LodDist4F
+ LodDist4F,
+ AnimCountI
};
};
@@ -1929,6 +1931,29 @@ DLL H3DNode h3dAddModelNode( H3DNode parent, const char *name, H3DRes geometryRe
DLL void h3dSetupModelAnimStage( H3DNode modelNode, int stage, H3DRes animationRes, int layer,
const char *startNode, bool additive );
+/* Function: h3dGetModelAnimParams
+ Gets the animation stage parameters of a Model node.
+
+ Details:
+ This function gets the current animation time and weight for a specified stage of the
+ specified model. The time corresponds to the frames of the animation and the animation is
+ looped if the time is higher than the maximum number of frames in the Animation resource.
+ The weight is used for animation blending and determines how much influence the stage has compared
+ to the other active stages.
+
+ Parameters:
+ modelNode - handle to the Model node to be accessed
+ stage - index of the animation stage to be accessed
+ time - pointer to variable where the time of the animation stage will be stored
+ (can be NULL if not required)
+ weight - pointer to variable where the blend weight of the animation stage will be stored
+ (can be NULL if not required)
+
+ Returns:
+ nothing
+*/
+DLL void h3dGetModelAnimParams( H3DNode modelNode, int stage, float *time, float *weight );
+
/* Function: h3dSetModelAnimParams
Sets the animation stage parameters of a Model node.
diff --git a/Horde3D/Bindings/C++/Horde3DUtils.h b/Horde3D/Bindings/C++/Horde3DUtils.h
index 9019fe83..8115ccb2 100644
--- a/Horde3D/Bindings/C++/Horde3DUtils.h
+++ b/Horde3D/Bindings/C++/Horde3DUtils.h
@@ -77,58 +77,6 @@ DLL void h3dutFreeMem( char **ptr );
*/
DLL bool h3dutDumpMessages();
-
-/* Group: OpenGL-related functions */
-/* Function: h3dutInitOpenGL
- Initializes OpenGL.
-
- Details:
- This utility function initializes an OpenGL rendering context in a specified window component.
-
- *Currently this function is only available on Windows platforms.*
-
- Parameters:
- hDC - handle to device context for which OpenGL context shall be created
-
- Returns:
- true in case of success, otherwise false
-*/
-DLL bool h3dutInitOpenGL( int hDC );
-
-/* Function: h3dutReleaseOpenGL
- Releases OpenGL.
-
- Details:
- This utility function destroys the previously created OpenGL rendering context.
-
- *Currently this function is only available on Windows platforms.*
-
- Parameters:
- none
-
- Returns:
- nothing
-*/
-DLL void h3dutReleaseOpenGL();
-
-/* Function: h3dutSwapBuffers
- Displays the rendered image on the screen.
-
- Details:
- This utility function displays the image rendered to the previously initialized OpenGL context
- on the screen by copying it from the backbuffer to the frontbuffer.
-
- *Currently this function is only available on Windows platforms.*
-
- Parameters:
- none
-
- Returns:
- nothing
-*/
-DLL void h3dutSwapBuffers();
-
-
/* Group: Resource management */
/* Function: h3dutGetResourcePath
*Deprecated*
diff --git a/Horde3D/Samples/Chicago .NET/RenderForm.cs b/Horde3D/Samples/Chicago .NET/RenderForm.cs
index eb546a84..3450eb1e 100644
--- a/Horde3D/Samples/Chicago .NET/RenderForm.cs
+++ b/Horde3D/Samples/Chicago .NET/RenderForm.cs
@@ -19,17 +19,18 @@
using Horde3DNET;
using Horde3DNET.Utils;
+using System.Runtime.InteropServices;
+
namespace Horde3DNET.Samples.ChicagoNET
{
internal partial class RenderForm : Form
{
- [System.Runtime.InteropServices.DllImport("user32.dll")]
- static extern IntPtr GetDC( IntPtr hWnd);
-
+
// standard vars
private bool appFullscreen = false;
private float fps = 30.0f;
+ IntPtr dc = IntPtr.Zero, hglrc = IntPtr.Zero;
// main application
private Application app = new Application();
@@ -45,7 +46,7 @@ internal partial class RenderForm : Form
/// Constructor.
///
public RenderForm()
- {
+ {
InitializeComponent();
// Fullscreen
@@ -71,14 +72,28 @@ public RenderForm()
///
private void RenderForm_Load(object sender, EventArgs e)
{
- if (!Horde3DUtils.initOpenGL(GetDC( renderPanel.Handle ).ToInt32()))
- throw new Exception("Failed to initialize OpenGL");
+ OpenGL.PIXELFORMATDESCRIPTOR pixelformatdescriptor = new OpenGL.PIXELFORMATDESCRIPTOR();
+ pixelformatdescriptor.Init();
+
+ dc = OpenGL.GetDC(renderPanel.Handle);
+ int pixelFormat = OpenGL.ChoosePixelFormat(dc, ref pixelformatdescriptor);
+ if (!OpenGL.SetPixelFormat(dc, pixelFormat, ref pixelformatdescriptor))
+ throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
+
+ if ((hglrc = OpenGL.wglCreateContext(dc)) == IntPtr.Zero)
+ throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
+
+ if (!OpenGL.wglMakeCurrent(dc, hglrc))
+ {
+ OpenGL.wglDeleteContext(hglrc);
+ MessageBox.Show("Failed to init OpenGL context\nMake sure you have an OpenGL 2.0 compatible graphics card with the latest drivers installed!\nAlso verify if the pipeline config file exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ Environment.Exit(0);
+ }
if (!app.init())
{
MessageBox.Show("Failed to init application\nMake sure you have an OpenGL 2.0 compatible graphics card with the latest drivers installed!\nAlso verify if the pipeline config file exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- h3d.release();
- Horde3DUtils.releaseOpenGL();
+ h3d.release();
Environment.Exit(0);
}
@@ -106,7 +121,9 @@ public void MainLoop()
// render
app.mainLoop(fps);
- Horde3DUtils.swapBuffers();
+
+ // Swap buffers
+ OpenGL.SwapBuffers(dc);
// if mouse tracking is disabled call Invalidate() to redraw the scene
Invalidate();
@@ -219,7 +236,9 @@ private void RenderForm_FormClosed(object sender, FormClosedEventArgs e)
// release h3d
app.release();
- Horde3DUtils.releaseOpenGL();
+
+ OpenGL.wglDeleteContext(hglrc);
+
Environment.Exit(0);
}
}
diff --git a/Horde3D/Samples/Knight .NET/RenderForm.cs b/Horde3D/Samples/Knight .NET/RenderForm.cs
index d70a4e90..183b91f0 100644
--- a/Horde3D/Samples/Knight .NET/RenderForm.cs
+++ b/Horde3D/Samples/Knight .NET/RenderForm.cs
@@ -20,17 +20,16 @@
using System.Diagnostics;
using Horde3DNET;
using Horde3DNET.Utils;
+using System.Runtime.InteropServices;
namespace Horde3DNET.Samples.KnightNET
{
internal partial class RenderForm : Form
{
- [System.Runtime.InteropServices.DllImport("user32.dll")]
- static extern IntPtr GetDC(IntPtr hWnd);
-
// standard vars
private bool appFullscreen = false;
private float fps = 30.0f;
+ IntPtr dc = IntPtr.Zero, hglrc = IntPtr.Zero;
// main application
private Application app = new Application();
@@ -72,14 +71,29 @@ public RenderForm()
///
private void RenderForm_Load(object sender, EventArgs e)
{
- if (!Horde3DUtils.initOpenGL(GetDC(renderPanel.Handle).ToInt32()))
- throw new Exception("Failed to initialize OpenGL");
+ OpenGL.PIXELFORMATDESCRIPTOR pixelformatdescriptor = new OpenGL.PIXELFORMATDESCRIPTOR();
+ pixelformatdescriptor.Init();
+
+ dc = OpenGL.GetDC(renderPanel.Handle);
+ int pixelFormat = OpenGL.ChoosePixelFormat(dc, ref pixelformatdescriptor);
+ if (!OpenGL.SetPixelFormat(dc, pixelFormat, ref pixelformatdescriptor))
+ throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
+
+ if ((hglrc = OpenGL.wglCreateContext(dc)) == IntPtr.Zero)
+ throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
+
+ if (!OpenGL.wglMakeCurrent(dc, hglrc))
+ {
+ OpenGL.wglDeleteContext(hglrc);
+ MessageBox.Show("Failed to init OpenGL context\nMake sure you have an OpenGL 2.0 compatible graphics card with the latest drivers installed!\nAlso verify if the pipeline config file exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ Environment.Exit(0);
+ }
if (!app.init())
{
MessageBox.Show("Failed to init application.\nMake sure you have an OpenGL 2.0 compatible graphics card with the latest drivers installed!\nAlso verify if the pipeline config file exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
h3d.release();
- Horde3DUtils.releaseOpenGL();
+ OpenGL.wglDeleteContext(hglrc);
Environment.Exit(0);
}
@@ -107,7 +121,7 @@ public void MainLoop()
// render
app.mainLoop(fps);
- Horde3DUtils.swapBuffers();
+ OpenGL.SwapBuffers(dc);
// if mouse tracking is disabled call Invalidate() to redraw the scene
//Invalidate();
@@ -221,7 +235,7 @@ private void RenderForm_FormClosed(object sender, FormClosedEventArgs e)
// release h3d
app.release();
- Horde3DUtils.releaseOpenGL();
+ OpenGL.wglDeleteContext(hglrc);
Environment.Exit(0);
}
}
diff --git a/Horde3D/Source/Horde3DEngine/egAnimation.cpp b/Horde3D/Source/Horde3DEngine/egAnimation.cpp
index c734f72c..266df910 100644
--- a/Horde3D/Source/Horde3DEngine/egAnimation.cpp
+++ b/Horde3D/Source/Horde3DEngine/egAnimation.cpp
@@ -519,4 +519,29 @@ bool AnimationController::animate()
return true;
}
+
+int AnimationController::getAnimCount()
+{
+ return _activeStages.size();
+}
+
+
+void AnimationController::getAnimParams( int stage, float *time, float *weight )
+{
+ if( (unsigned)stage > _animStages.size() )
+ {
+ Modules::setError( "Invalid stage in h3dGetModelAnimParams" );
+ return;
+ }
+
+ AnimStage &curStage = _animStages[stage];
+ if( curStage.anim == 0x0 ) return;
+
+ if (time)
+ *time = curStage.animTime;
+
+ if (weight)
+ *weight = curStage.weight;
+}
+
} // namespace
diff --git a/Horde3D/Source/Horde3DEngine/egAnimation.h b/Horde3D/Source/Horde3DEngine/egAnimation.h
index 9c46d7b9..af975e66 100644
--- a/Horde3D/Source/Horde3DEngine/egAnimation.h
+++ b/Horde3D/Source/Horde3DEngine/egAnimation.h
@@ -132,6 +132,9 @@ class AnimationController
bool setAnimParams( int stage, float time, float weight );
bool animate();
+ int getAnimCount();
+ void getAnimParams( int stage, float *time, float *weight );
+
protected:
void mapAnimRes( uint32 node, uint32 stage );
void updateActiveList();
diff --git a/Horde3D/Source/Horde3DEngine/egMain.cpp b/Horde3D/Source/Horde3DEngine/egMain.cpp
index fe77ce1e..b94eba75 100644
--- a/Horde3D/Source/Horde3DEngine/egMain.cpp
+++ b/Horde3D/Source/Horde3DEngine/egMain.cpp
@@ -764,6 +764,15 @@ DLLEXP void h3dSetupModelAnimStage( NodeHandle modelNode, int stage, ResHandle a
}
+DLLEXP void h3dGetModelAnimParams( NodeHandle modelNode, int stage, float *time, float *weight )
+{
+ SceneNode *sn = Modules::sceneMan().resolveNodeHandle( modelNode );
+ APIFUNC_VALIDATE_NODE_TYPE( sn, SceneNodeTypes::Model, "h3dGetModelAnimParams", APIFUNC_RET_VOID );
+
+ ((ModelNode *)sn)->getAnimParams( stage, time, weight );
+}
+
+
DLLEXP void h3dSetModelAnimParams( NodeHandle modelNode, int stage, float time, float weight )
{
SceneNode *sn = Modules::sceneMan().resolveNodeHandle( modelNode );
diff --git a/Horde3D/Source/Horde3DEngine/egModel.cpp b/Horde3D/Source/Horde3DEngine/egModel.cpp
index 23249b3e..f15c40dc 100644
--- a/Horde3D/Source/Horde3DEngine/egModel.cpp
+++ b/Horde3D/Source/Horde3DEngine/egModel.cpp
@@ -137,6 +137,12 @@ void ModelNode::setupAnimStage( int stage, AnimationResource *anim, int layer,
}
+void ModelNode::getAnimParams( int stage, float *time, float *weight )
+{
+ _animCtrl.getAnimParams( stage, time, weight );
+}
+
+
void ModelNode::setAnimParams( int stage, float time, float weight )
{
if( _animCtrl.setAnimParams( stage, time, weight ) ) markDirty();
diff --git a/Horde3D/Source/Horde3DEngine/egModel.h b/Horde3D/Source/Horde3DEngine/egModel.h
index 0290414f..f97c5f76 100644
--- a/Horde3D/Source/Horde3DEngine/egModel.h
+++ b/Horde3D/Source/Horde3DEngine/egModel.h
@@ -39,7 +39,8 @@ struct ModelNodeParams
LodDist1F,
LodDist2F,
LodDist3F,
- LodDist4F
+ LodDist4F,
+ AnimCountI
};
};
@@ -91,6 +92,7 @@ class ModelNode : public SceneNode
void recreateNodeList();
void setupAnimStage( int stage, AnimationResource *anim, int layer,
const std::string &startNode, bool additive );
+ void getAnimParams( int stage, float *time, float *weight );
void setAnimParams( int stage, float time, float weight );
bool setMorphParam( const std::string &targetName, float weight );
diff --git a/Horde3D/Source/Horde3DUtils/main.cpp b/Horde3D/Source/Horde3DUtils/main.cpp
index ef4fb3b6..b279878c 100644
--- a/Horde3D/Source/Horde3DUtils/main.cpp
+++ b/Horde3D/Source/Horde3DUtils/main.cpp
@@ -22,9 +22,6 @@
# endif
# include
#endif
-#ifndef PLATFORM_MAC
-# include
-#endif
#include
#include
#include
@@ -55,11 +52,6 @@ struct InfoBox
ofstream outf;
map< int, string > resourcePaths;
-#ifdef PLATFORM_WIN
-HDC hDC = 0;
-HGLRC hRC = 0;
-#endif
-
string cleanPath( string path )
{
@@ -94,94 +86,6 @@ string cleanPath( string path )
using namespace Horde3DUtils;
-// TODO: Make OpenGL functions platform independent
-
-DLLEXP bool h3dutInitOpenGL( int hdc )
-{
-#ifdef PLATFORM_WIN
- hDC = (HDC)(__int64)hdc;
-
- // Init OpenGL rendering context
- int pixelFormat;
-
- static PIXELFORMATDESCRIPTOR pfd =
- {
- sizeof( PIXELFORMATDESCRIPTOR ), // Size of this pixel format descriptor
- 1, // Version number
- PFD_DRAW_TO_WINDOW | // Format must support window
- PFD_SUPPORT_OPENGL | // Format must support OpenGL
- PFD_DOUBLEBUFFER, // Must support double buffering
- PFD_TYPE_RGBA, // Request a RGBA format
- 32, // Select our color depth
- 0, 0, 0, 0, 0, 0, // Color bits ignored
- 8, // 8Bit alpha buffer
- 0, // Shift bit ignored
- 0, // No accumulation buffer
- 0, 0, 0, 0, // Accumulation bits ignored
- 32, // 32Bit z-buffer (depth buffer)
- 8, // 8Bit stencil buffer
- 0, // No auxiliary buffer
- PFD_MAIN_PLANE, // Main drawing layer
- 0, // Reserved
- 0, 0, 0 // Layer masks ignored
- };
-
- if( !(pixelFormat = ChoosePixelFormat( hDC, &pfd )) )
- {
- return false;
- }
-
- if( !SetPixelFormat( hDC, pixelFormat, &pfd ) )
- {
- return false;
- }
-
- if( !(hRC = wglCreateContext( hDC )) )
- {
- return false;
- }
-
- if( !wglMakeCurrent( hDC, hRC ) )
- {
- wglDeleteContext( hRC );
- return false;
- }
-
- return true;
-
-#else
- return false;
-#endif
-}
-
-
-DLLEXP void h3dutReleaseOpenGL()
-{
-#ifdef PLATFORM_WIN
- if( hDC == 0 || hRC == 0 ) return;
-
- if( !wglMakeCurrent( 0x0, 0x0 ) )
- {
- return;
- }
- if( !wglDeleteContext( hRC ) )
- {
- return;
- }
- hRC = 0;
-#endif
-}
-
-
-DLLEXP void h3dutSwapBuffers()
-{
-#ifdef PLATFORM_WIN
- if( hDC == 0 || hRC == 0 ) return;
-
- SwapBuffers( hDC );
-#endif
-}
-
DLLEXP const char *h3dutGetResourcePath( int type )
{