From 92509d3b70dd4f686caf8d9d9d449f86b258b125 Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Wed, 13 Apr 2011 20:35:44 -0400 Subject: [PATCH] Trying to animate creatures --- apps/openmw/mwclass/creature.cpp | 2 +- apps/openmw/mwrender/cellimp.hpp | 2 ++ apps/openmw/mwrender/exterior.cpp | 15 +++++++++++++++ apps/openmw/mwrender/exterior.hpp | 2 ++ apps/openmw/mwrender/interior.cpp | 17 +++++++++++++++++ apps/openmw/mwrender/interior.hpp | 2 ++ 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 8cde67671..5316c8267 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -34,7 +34,7 @@ namespace MWClass if (!model.empty()) { MWRender::Rendering rendering (cellRender, ref->ref); - cellRender.insertMesh ("meshes\\" + model); + cellRender.insertMesh("meshes\\" + model); cellRender.insertActorPhysics(); ref->mData.setHandle (rendering.end (ref->mData.isEnabled())); } diff --git a/apps/openmw/mwrender/cellimp.hpp b/apps/openmw/mwrender/cellimp.hpp index 272bfeeab..727c9d317 100644 --- a/apps/openmw/mwrender/cellimp.hpp +++ b/apps/openmw/mwrender/cellimp.hpp @@ -7,6 +7,7 @@ #include "../mwworld/refdata.hpp" #include +#include namespace Ogre { @@ -42,6 +43,7 @@ namespace MWRender virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst) = 0; virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements) = 0; virtual void insertMesh(const std::string &mesh) = 0; + //virtual Ogre::Entity* insertAndDeliverMesh(const std::string &mesh) = 0; virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements) = 0; diff --git a/apps/openmw/mwrender/exterior.cpp b/apps/openmw/mwrender/exterior.cpp index fe54af84a..aa712dede 100644 --- a/apps/openmw/mwrender/exterior.cpp +++ b/apps/openmw/mwrender/exterior.cpp @@ -273,6 +273,21 @@ std::string ExteriorCellRender::insertEnd (bool enable) return handle; } +/* +Ogre::Entity* ExteriorCellRender::insertAndDeliverMesh(const std::string &mesh) +{ + assert (insert); + + NIFLoader::load(mesh); + Entity *ent = mScene.getMgr()->createEntity(mesh); + ent->setDisplaySkeleton(true); + + + mInsert->attachObject(ent); + return ent; + +}*/ + // configure lighting according to cell void ExteriorCellRender::configureAmbient() diff --git a/apps/openmw/mwrender/exterior.hpp b/apps/openmw/mwrender/exterior.hpp index 93491f263..87659a213 100644 --- a/apps/openmw/mwrender/exterior.hpp +++ b/apps/openmw/mwrender/exterior.hpp @@ -6,6 +6,7 @@ #include "OgreColourValue.h" #include +#include namespace Ogre { @@ -70,6 +71,7 @@ namespace MWRender virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst); virtual void insertMesh(const std::string &mesh); + //virtual Ogre::Entity* insertAndDeliverMesh(const std::string &mesh); virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements); virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements); diff --git a/apps/openmw/mwrender/interior.cpp b/apps/openmw/mwrender/interior.cpp index dbacaacf9..d3ec9b442 100644 --- a/apps/openmw/mwrender/interior.cpp +++ b/apps/openmw/mwrender/interior.cpp @@ -180,6 +180,23 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, } } +/* +Ogre::Entity* InteriorCellRender::insertAndDeliverMesh(const std::string &mesh) +{ + + assert (insert); + + NIFLoader::load(mesh); + Entity *ent = scene.getMgr()->createEntity(mesh); + ent->setDisplaySkeleton(true); + + + insert->attachObject(ent); + return ent; + +}*/ + + void InteriorCellRender::insertMesh(const std::string &mesh) { assert (insert); diff --git a/apps/openmw/mwrender/interior.hpp b/apps/openmw/mwrender/interior.hpp index 7c4b2aaf1..f77d3358d 100644 --- a/apps/openmw/mwrender/interior.hpp +++ b/apps/openmw/mwrender/interior.hpp @@ -6,6 +6,7 @@ #include "OgreColourValue.h" #include +#include namespace Ogre { @@ -67,6 +68,7 @@ namespace MWRender virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements); virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements); /// insert a mesh related to the most recent insertBegin call. + //virtual Ogre::Entity* insertAndDeliverMesh(const std::string &mesh); virtual void insertMesh(const std::string &mesh); virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements); virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst);