Commit 60601682 authored by Jason Hooks's avatar Jason Hooks

Beast races fixed

parent 1896a6a2
......@@ -93,10 +93,14 @@ namespace MWClass
const ESM::BodyPart *knee = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "knee");
const ESM::BodyPart *ankle = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "ankle");
const ESM::BodyPart *foot = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "foot");
const ESM::BodyPart *feet = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet");
const ESM::BodyPart *tail = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "tail");
const ESM::BodyPart *wrist = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "wrist");
const ESM::BodyPart *forearm = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "forearm");
const ESM::BodyPart *hand = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "hand.1st");
const ESM::BodyPart *hands = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands.1st");
std::cout << "RACE" << bodyRaceID << "\n";
Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
......@@ -104,10 +108,13 @@ namespace MWClass
if (groin){
cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, Ogre::Radian(3.14), npcName + "groin", addresses, numbers);
std::cout <<"GROIN" << groin->model <<"\n";
addresses2[numbers] = npcName + "groin";
addresses[numbers++] = npcName + "groin";
}
if (tail) {
cellRender.insertMesh("tail\\" + tail->model, Ogre::Vector3(0 , 0, -76), axis, Ogre::Radian(3.14), npcName + "tail", addresses, numbers, "tail");
//std::cout << "TAIL\n";
}
//addresses[1] = npcName + "groin";
if(upperleg){
......@@ -135,19 +142,25 @@ namespace MWClass
addresses[numbers++] = npcName + "ankle";
}
if(foot){
//std::cout << "RACE" << bodyRaceID << "\n";
if(bodyRaceID.compare("b_n_khajiit_m_") == 0 || bodyRaceID.compare("b_n_khajiit_f_") == 0)
if(bodyRaceID.compare("b_n_khajiit_m_") == 0)
{
std::cout << "BEASTRACE\n";
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -24, -15), axis, Ogre::Radian(0), npcName + "foot", addresses, numbers);
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -24, -15), axis, Ogre::Radian(0), npcName + "foot2", addresses2, numbers);
feet = foot;
}
else{
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot", addresses, numbers);
else
{
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot", addresses, numbers);
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot2", addresses2, numbers);
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot2", addresses2, numbers);
addresses2[numbers] = npcName + "foot2";
addresses[numbers++] = npcName + "foot";
}
//cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
}
if(feet){
cellRender.insertMesh ("foot\\" + feet->model, Ogre::Vector3( 7, 4, -16), axis, Ogre::Radian(3.14), npcName + "foot", addresses, numbers); //9, 0, -14
cellRender.insertMesh ("foot\\" + feet->model, Ogre::Vector3( 7, 4, -16), axis, Ogre::Radian(3.14), npcName + "foot2", addresses2, numbers);
addresses2[numbers] = npcName + "foot2";
addresses[numbers++] = npcName + "foot";
//cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
......@@ -177,6 +190,14 @@ namespace MWClass
// std::cout << npcName << "has no forearm";
if (wrist)
{
if(upperleft[uppernumbers - 1].compare(npcName + "upper arm") == 0)
{
cellRender.insertMesh("meshes\\b\\B_N_Argonian_M_Forearm.nif", Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm", upperleft, uppernumbers);
cellRender.insertMesh("meshes\\b\\B_N_Argonian_M_Forearm.nif", Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm2", upperright, uppernumbers);
upperleft[uppernumbers] = npcName + "forearm";
upperright[uppernumbers++] = npcName + "forearm2";
}
cellRender.insertMesh("meshes\\" + wrist->model, Ogre::Vector3(-9.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "wrist", upperleft, uppernumbers);
cellRender.insertMesh("meshes\\" + wrist->model, Ogre::Vector3(-9.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "wrist2", upperright, uppernumbers);
upperleft[uppernumbers] = npcName + "wrist";
......@@ -220,6 +241,7 @@ namespace MWClass
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperright, uppernumbers);
}
//neck will reset chest counter
if(neck)
{
cellRender.insertMesh ("meshes\\" + neck->model, Ogre::Vector3( 0, 0, 120), axis, Ogre::Radian(3.14), npcName + "neck", neckandup, neckNumbers);
......
......@@ -8,6 +8,9 @@
#include <components/nifogre/ogre_nif_loader.hpp>
#include "mwscene.hpp"
#include <libs/mangle/vfs/servers/ogre_vfs.hpp>
#include "mwscene.hpp"
#include <Ogre.h>
using namespace MWRender;
using namespace Ogre;
......@@ -107,18 +110,66 @@ void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
}
npcPart = parent->createChildSceneNode(sceneNodeName);
NIFLoader::load(mesh,0,0);
MeshPtr good2 = NIFLoader::load(mesh);
MovableObject *ent = scene.getMgr()->createEntity(mesh);
//ent->extr
\
// MovableObject *ent2 = scene.getMgr()->createEntity(bounds
// );
//ent->
//std::cout << mesh << bounds << "\n";
npcPart->translate(vec);
npcPart->rotate(axis, angle);
npcPart->attachObject(ent);
Ogre::MeshManager *m = MeshManager::getSingletonPtr();
const std::string beast1 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
const std::string beastfoot1 ="foot\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beastfoot2 ="foot\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beastfoot3 ="foot\\b\\B_N_Argonian_F_Skins.nif";
const std::string beastfoot4 ="foot\\b\\B_N_Argonian_M_Skins.nif";
if(mesh.compare(beast1) == 0 && m->getByName(beasttail1).isNull())
{
//std::cout << "CLONINGKHAJIITF\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail1);
good2->reload();
MeshPtr foot = good2->clone(beastfoot1);
good2->reload();
}
else if(mesh.compare(beast2) == 0 && m->getByName(beasttail2).isNull())
{
//std::cout << "CLONINGKHAJIITM\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail2);
good2->reload();
MeshPtr foot = good2->clone(beastfoot2);
good2->reload();
}
else if(mesh.compare(beast3) == 0 && m->getByName(beasttail3).isNull())
{
//std::cout << "CLONINGARGONIANF\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail3);
good2->reload();
MeshPtr foot = good2->clone(beastfoot3);
good2->reload();
}
else if(mesh.compare(beast4) == 0 && m->getByName(beasttail4).isNull())
{
//std::cout << "CLONINGARGONIANM\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail4);
good2->reload();
MeshPtr foot = good2->clone(beastfoot4);
good2->reload();
}
}
// insert a mesh related to the most recent insertBegin call.
......
......@@ -9,6 +9,10 @@
#include <components/nifogre/ogre_nif_loader.hpp>
#include "mwscene.hpp"
#include <Ogre.h>
#include <stdio.h>
#include <libs/mangle/vfs/servers/ogre_vfs.hpp>
using namespace MWRender;
using namespace Ogre;
......@@ -99,8 +103,10 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
npcPart = parent->createChildSceneNode(sceneNodeName);
//npcPart->showBoundingBox(true);
MeshPtr good = NIFLoader::load(mesh, 0, 0);
MovableObject *ent = scene.getMgr()->createEntity(good->getName());
MeshPtr good2 = NIFLoader::load(mesh);
MovableObject *ent = scene.getMgr()->createEntity(mesh);
//ent->extr
// MovableObject *ent2 = scene.getMgr()->createEntity(bounds
......@@ -119,6 +125,57 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
}
npcPart->attachObject(ent);
Ogre::MeshManager *m = MeshManager::getSingletonPtr();
const std::string beast1 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
const std::string beastfoot1 ="foot\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beastfoot2 ="foot\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beastfoot3 ="foot\\b\\B_N_Argonian_F_Skins.nif";
const std::string beastfoot4 ="foot\\b\\B_N_Argonian_M_Skins.nif";
if(mesh.compare(beast1) == 0 && m->getByName(beasttail1).isNull())
{
//std::cout << "CLONINGKHAJIITF\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail1);
good2->reload();
MeshPtr foot = good2->clone(beastfoot1);
good2->reload();
}
else if(mesh.compare(beast2) == 0 && m->getByName(beasttail2).isNull())
{
//std::cout << "CLONINGKHAJIITM\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail2);
good2->reload();
MeshPtr foot = good2->clone(beastfoot2);
good2->reload();
}
else if(mesh.compare(beast3) == 0 && m->getByName(beasttail3).isNull())
{
//std::cout << "CLONINGARGONIANF\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail3);
good2->reload();
MeshPtr foot = good2->clone(beastfoot3);
good2->reload();
}
else if(mesh.compare(beast4) == 0 && m->getByName(beasttail4).isNull())
{
//std::cout << "CLONINGARGONIANM\n";
good2->reload();
MeshPtr tail = good2->clone(beasttail4);
good2->reload();
MeshPtr foot = good2->clone(beastfoot4);
good2->reload();
}
}
void InteriorCellRender::insertMesh(const std::string &mesh)
......
......@@ -55,7 +55,6 @@ using namespace Mangle::VFS;
NIFLoader& NIFLoader::getSingleton()
{
static NIFLoader instance;
return instance;
}
......@@ -334,8 +333,6 @@ void NIFLoader::findRealTexture(String &texName)
// mesh.
void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std::list<VertexBoneAssignment> &vertexBoneAssignments)
{
// cout << "s:" << shape << "\n";
NiTriShapeData *data = shape->data.getPtr();
SubMesh *sub = mesh->createSubMesh(shape->name.toString());
......@@ -429,7 +426,7 @@ void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std
for (std::list<VertexBoneAssignment>::iterator it = vertexBoneAssignments.begin();
it != vertexBoneAssignments.end(); it++)
{
sub->addBoneAssignment(*it);
sub->addBoneAssignment(*it);
}
}
......@@ -782,6 +779,8 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
if (!skel.isNull()) //if there is a skeleton
{
std::string name = node->name.toString();
//if (isBeast && isChest)
// std::cout << "NAME: " << name << "\n";
// Quick-n-dirty workaround for the fact that several
// bones may have the same name.
if(!skel->hasBone(name))
......@@ -840,14 +839,48 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
else if (node->recType == RC_NiTriShape)
{
// For shapes
if((isChest && stack < 10) || (isHands && counter < 3) || !(isChest || isHands)){ //less than 10
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
/*For Beast Skins, Shape Bone Names
Tri Left Foot
Tri Right Foot
Tri Tail
Tri Chest
*/
if((isChest && stack < 10 ) || (isHands && counter < 3) || !(isChest || isHands)){ //(isBeast && isChest && stack < 10 && counter == skincounter )
std::string name = node->name.toString();
//if (isChest)
//std::cout << "NAME: " << name << "\n";
if(isChest && isBeast && skincounter == 0 && name.compare("Tri Chest") == 0){
//std::cout <<"BEASTCHEST1\n";
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
skincounter++;
}
else if(isChest && isBeast && skincounter == 1 && name.compare("Tri Tail") == 0){
//std::cout <<"BEASTCHEST2\n";
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
skincounter++;
}
else if(isChest && isBeast && skincounter == 2 && name.compare("Tri Left Foot") == 0){
//std::cout <<"BEASTCHEST3\n";
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
skincounter=1000;
}
else if (!isChest || !isBeast)
{
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
}
//if(isBeast && isChest)
//cout << "Handling Shape, Stack " << stack <<"\n";
counter++;
}
if(isHands){
/*if(isHands){
//cout << "Handling Shape, Stack " << stack <<"\n";
counter++;
}
}*/
}
......@@ -856,9 +889,16 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
void NIFLoader::loadResource(Resource *resource)
{
if(skincounter == 1000)
skincounter = 0;
stack = 0;
counter = 0;
std::string name = resource->getName();
if(resourceName.compare(name) != 0)
{
skincounter = 0;
resourceName = name;
}
//std::cout <<"NAME:" << name;
//if(name.length() >= 20)
// {std::string split = name.substr(name.length() - 20, 20);
......@@ -905,7 +945,7 @@ void NIFLoader::loadResource(Resource *resource)
if(name.compare(test11) == 0 || name.compare(test12) == 0 || name.compare(test13) == 0 || name.compare(test14) == 0)
{
isBeast = true;
std::cout << "Welcome Beast\n";
//std::cout << "Welcome Beast\n";
}
else
isBeast = false;
......@@ -938,12 +978,14 @@ void NIFLoader::loadResource(Resource *resource)
name.compare(hands13) == 0 || name.compare(hands14) == 0 || name.compare(hands15) == 0 || name.compare(hands16) == 0 ||
name.compare(hands17) == 0 || name.compare(hands18) == 0 || name.compare(hands19) == 0 || name.compare(hands20) == 0)
{
std::cout << "Welcome Hands1st\n";
//std::cout << "Welcome Hands1st\n";
isHands = true;
isChest = false;
}
else
isHands = false;
/*
else if(name.compare(test3) == 0 || name.compare(test4) == 0)
{
......@@ -1039,25 +1081,40 @@ void NIFLoader::loadResource(Resource *resource)
}
MeshPtr NIFLoader::load(const std::string &name,
int pieces, int pieceIndex,const std::string &group)
const std::string &group)
{
MeshManager *m = MeshManager::getSingletonPtr();
// Check if the resource already exists
ResourcePtr ptr = m->getByName(name, group);
MeshPtr resize;
if (!ptr.isNull()){
const std::string beast1 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
if (!ptr.isNull()){
//if(pieces > 1)
//cout << "It exists\n";
resize = MeshPtr(ptr);
resize = MeshPtr(ptr);
//resize->load();
//resize->reload();
}
else // Nope, create a new one.
{
resize = MeshManager::getSingleton().createManual(name, group, NIFLoader::getSingletonPtr());
//cout <<"EXISTING" << name << "\n";
//if(pieces > 1)
//cout << "Creating it\n";
resize = MeshManager::getSingleton().createManual(name, group, NIFLoader::getSingletonPtr());
//resize->load();
//resize->reload();
//return 0;
......@@ -1076,12 +1133,6 @@ MeshPtr NIFLoader::load(const std::string &name,
}
MeshPtr NIFLoader::load(const std::string &name,
const std::string &group)
{
return load(name, 1, 0, group);
}
/* More code currently not in use, from the old D source. This was
used in the first attempt at loading NIF meshes, where each submesh
in the file was given a separate bone in a skeleton. Unfortunately
......
......@@ -76,15 +76,13 @@ class NIFLoader : Ogre::ManualResourceLoader
static Ogre::MeshPtr load(const std::string &name,
const std::string &group="General");
static Ogre::MeshPtr load(const std::string &name,
int pieces, int pieceIndex, const std::string &group="General");
Ogre::Vector3 convertVector3(const Nif::Vector& vec);
Ogre::Quaternion convertRotation(const Nif::Matrix& rot);
private:
NIFLoader() : resourceGroup("General") {}
NIFLoader() : resourceGroup("General") { skincounter = 0; resourceName = "";}
NIFLoader(NIFLoader& n) {}
void warn(std::string msg);
......@@ -125,9 +123,11 @@ class NIFLoader : Ogre::ManualResourceLoader
std::string resourceName;
std::string resourceGroup;
int skincounter;
bool isChest;
bool isBeast;
bool isHands;
bool isFeet;
int counter;
int numbers;
int stack;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment