more stuff

This commit is contained in:
Jason Hooks 2011-12-09 03:02:09 -05:00
parent ee98a2af1a
commit 5c48d8fc1e
5 changed files with 51 additions and 19 deletions

View file

@ -33,19 +33,6 @@ namespace MWClass
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{ {
renderingInterface.getActors().insertNPC(ptr); renderingInterface.getActors().insertNPC(ptr);
/*
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
ptr.get<ESM::NPC>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
if (!model.empty())
{
MWRender::Npcs& npcs = renderingInterface.getNPCs();
//npcs.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
//npcs.insertMesh(ptr, "meshes\\" + model);
}*/
} }
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const

View file

@ -1,6 +1,7 @@
#include "actors.hpp" #include "actors.hpp"
#include <OgreSceneNode.h> #include <OgreSceneNode.h>
#include <components/nifogre/ogre_nif_loader.hpp> #include <components/nifogre/ogre_nif_loader.hpp>
#include "../mwworld/world.hpp"
using namespace Ogre; using namespace Ogre;
using namespace MWRender; using namespace MWRender;
@ -9,8 +10,15 @@ using namespace NifOgre;
void Actors::setMwRoot(Ogre::SceneNode* root){ void Actors::setMwRoot(Ogre::SceneNode* root){
mMwRoot = root; mMwRoot = root;
} }
Ogre::Entity* Actors::insertBoundedPart(const std::string &mesh, std::string bonename, Ogre::Entity* base){
NIFLoader::load(mesh);
Entity* ent = mRend.getScene()->createEntity(mesh);
base->attachObjectToBone(bonename, ent);
return ent;
}
void Actors::insertNPC(const MWWorld::Ptr& ptr){ void Actors::insertNPC(const MWWorld::Ptr& ptr){
/*
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref = ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
ptr.get<ESM::NPC>(); ptr.get<ESM::NPC>();
assert (ref->base != NULL); assert (ref->base != NULL);
@ -45,6 +53,18 @@ void Actors::insertNPC(const MWWorld::Ptr& ptr){
bool female = tolower(secondtolast) == 'f'; bool female = tolower(secondtolast) == 'f';
bool beast = bodyRaceID == "b_n_khajiit_m_" || bodyRaceID == "b_n_khajiit_f_" || bodyRaceID == "b_n_argonian_m_" || bodyRaceID == "b_n_argonian_f_"; bool beast = bodyRaceID == "b_n_khajiit_m_" || bodyRaceID == "b_n_khajiit_f_" || bodyRaceID == "b_n_argonian_m_" || bodyRaceID == "b_n_argonian_f_";
std::string smodel = "meshes\\base_anim.nif";
if(beast)
smodel = "meshes\\base_animkna.nif";
Ogre::SceneNode* insert = ptr.getRefData().getBaseNode();
assert(insert);
NifOgre::NIFLoader::load(smodel);
Entity *base = mRend.getScene()->createEntity(smodel);
insert->attachObject(base);
std::string headModel = "meshes\\" + std::string headModel = "meshes\\" +
mEnvironment.mWorld->getStore().bodyParts.find(headID)->model; mEnvironment.mWorld->getStore().bodyParts.find(headID)->model;
@ -72,7 +92,23 @@ void Actors::insertNPC(const MWWorld::Ptr& ptr){
const ESM::BodyPart* handr = handl; const ESM::BodyPart* handr = handl;
const ESM::BodyPart* forearmr = forearml; const ESM::BodyPart* forearmr = forearml;
const ESM::BodyPart* wristr = wristl; const ESM::BodyPart* wristr = wristl;
const ESM::BodyPart* armr = arml;*/ const ESM::BodyPart* armr = arml;
if(upperleg){
insertBoundedPart("meshes\\" + upperleg->model + "*|", "Left Upper Leg", base);
insertBoundedPart("meshes\\" + upperleg->model, "Right Upper Leg", base);
}
if(foot){
if(bodyRaceID.compare("b_n_khajiit_m_") == 0)
{
feet = foot;
}
else
{
insertBoundedPart("meshes\\" + foot->model, "Right Foot", base);
insertBoundedPart("meshes\\" + foot->model + "*|", "Left Foot", base);
}
}
} }
void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){ void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
Ogre::SceneNode* cellnode; Ogre::SceneNode* cellnode;

View file

@ -4,11 +4,17 @@
#include "components/esm_store/cell_store.hpp" #include "components/esm_store/cell_store.hpp"
#include <map> #include <map>
#include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
#include <openengine/ogre/renderer.hpp> #include <openengine/ogre/renderer.hpp>
#include "components/nifogre/ogre_nif_loader.hpp" #include "components/nifogre/ogre_nif_loader.hpp"
#include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontalk.hpp"
#include "../mwworld/environment.hpp" #include "../mwworld/environment.hpp"
namespace MWRender{ namespace MWRender{
class Actors{ class Actors{
OEngine::Render::OgreRenderer &mRend; OEngine::Render::OgreRenderer &mRend;
@ -21,6 +27,7 @@ namespace MWRender{
public: public:
Actors(OEngine::Render::OgreRenderer& _rend, MWWorld::Environment& _env): mRend(_rend), mEnvironment(_env){} Actors(OEngine::Render::OgreRenderer& _rend, MWWorld::Environment& _env): mRend(_rend), mEnvironment(_env){}
~Actors(){} ~Actors(){}
Ogre::Entity* Actors::insertBoundedPart(const std::string &mesh, std::string bonename, Ogre::Entity* base);
void setMwRoot(Ogre::SceneNode* root); void setMwRoot(Ogre::SceneNode* root);
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_); void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh); void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);

View file

@ -476,6 +476,7 @@ void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std
HardwareBuffer::HBU_STATIC_WRITE_ONLY, true); HardwareBuffer::HBU_STATIC_WRITE_ONLY, true);
if(flip && mFlipVertexWinding && sub->indexData->indexCount % 3 == 0){ if(flip && mFlipVertexWinding && sub->indexData->indexCount % 3 == 0){
std::cout << "INTHEWINDING\n";
sub->indexData->indexBuffer = ibuf; sub->indexData->indexBuffer = ibuf;
uint16 *datamod = new uint16[numFaces]; uint16 *datamod = new uint16[numFaces];
@ -1183,7 +1184,7 @@ void NIFLoader::loadResource(Resource *resource)
} }
if(flip) if(flip)
{ {
//std::cout << "Flipping"; std::cout << "Flipping";
calculateTransform(); calculateTransform();
} }
// Set up the VFS if it hasn't been done already // Set up the VFS if it hasn't been done already

View file

@ -119,7 +119,8 @@ class NIFLoader : Ogre::ManualResourceLoader
Ogre::Quaternion convertRotation(const Nif::Matrix& rot); Ogre::Quaternion convertRotation(const Nif::Matrix& rot);
private: private:
NIFLoader() : resourceGroup("General") {resourceName = "";} NIFLoader() : resourceGroup("General"),mNormaliseNormals(false),
mFlipVertexWinding(false), flip(false) {resourceName = "";}
NIFLoader(NIFLoader& n) {} NIFLoader(NIFLoader& n) {}
void calculateTransform(); void calculateTransform();