more stuff

pull/21/head
Jason Hooks 13 years ago
parent ee98a2af1a
commit 5c48d8fc1e

@ -33,19 +33,6 @@ namespace MWClass
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
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

@ -1,6 +1,7 @@
#include "actors.hpp"
#include <OgreSceneNode.h>
#include <components/nifogre/ogre_nif_loader.hpp>
#include "../mwworld/world.hpp"
using namespace Ogre;
using namespace MWRender;
@ -9,8 +10,15 @@ using namespace NifOgre;
void Actors::setMwRoot(Ogre::SceneNode* 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){
/*
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
ptr.get<ESM::NPC>();
assert (ref->base != NULL);
@ -45,6 +53,18 @@ void Actors::insertNPC(const MWWorld::Ptr& ptr){
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_";
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\\" +
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* forearmr = forearml;
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_){
Ogre::SceneNode* cellnode;

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

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

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

Loading…
Cancel
Save