mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Preliminary NPCs
This commit is contained in:
parent
a9892161af
commit
6aaedff86a
5 changed files with 85 additions and 3 deletions
|
@ -6,6 +6,13 @@
|
||||||
#include "components/esm_store/cell_store.hpp"
|
#include "components/esm_store/cell_store.hpp"
|
||||||
|
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
|
#include <OgreMath.h>
|
||||||
|
|
||||||
|
namespace Ogre
|
||||||
|
{
|
||||||
|
class SceneNode;
|
||||||
|
class Vector3;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
@ -16,7 +23,6 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
class Environment;
|
class Environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
/// Base class for cell render, that implements inserting references into a cell in a
|
/// Base class for cell render, that implements inserting references into a cell in a
|
||||||
|
@ -31,9 +37,12 @@ namespace MWRender
|
||||||
/// start inserting a new reference.
|
/// start inserting a new reference.
|
||||||
virtual void insertBegin (ESM::CellRef &ref) = 0;
|
virtual void insertBegin (ESM::CellRef &ref) = 0;
|
||||||
|
|
||||||
|
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements) = 0;
|
||||||
/// insert a mesh related to the most recent insertBegin call.
|
/// insert a mesh related to the most recent insertBegin call.
|
||||||
|
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 void insertMesh(const std::string &mesh) = 0;
|
||||||
|
|
||||||
|
|
||||||
/// insert a light related to the most recent insertBegin call.
|
/// insert a light related to the most recent insertBegin call.
|
||||||
virtual void insertLight(float r, float g, float b, float radius) = 0;
|
virtual void insertLight(float r, float g, float b, float radius) = 0;
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,43 @@ void ExteriorCellRender::insertBegin (ESM::CellRef &ref)
|
||||||
insert->setOrientation(xr*yr*zr);
|
insert->setOrientation(xr*yr*zr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExteriorCellRender::rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements)
|
||||||
|
{
|
||||||
|
assert(insert);
|
||||||
|
Ogre::SceneNode *parent = insert;
|
||||||
|
//std::cout << "ELEMENTS:" << elements;
|
||||||
|
for (int i = 0; i < elements; i++){
|
||||||
|
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||||
|
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||||
|
}
|
||||||
|
parent->rotate(axis, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements){
|
||||||
|
assert (insert);
|
||||||
|
//insert->
|
||||||
|
Ogre::SceneNode *parent = insert;
|
||||||
|
for (int i = 0; i < elements; i++){
|
||||||
|
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||||
|
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||||
|
NIFLoader::load(mesh);
|
||||||
|
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||||
|
|
||||||
|
npcPart->translate(vec);
|
||||||
|
npcPart->rotate(axis, angle);
|
||||||
|
// npcPart->translate(vec);
|
||||||
|
//npcPart->rotate(axis, angle);
|
||||||
|
npcPart->attachObject(ent);
|
||||||
|
//npcPart->
|
||||||
|
|
||||||
|
}
|
||||||
// insert a mesh related to the most recent insertBegin call.
|
// insert a mesh related to the most recent insertBegin call.
|
||||||
|
|
||||||
|
|
||||||
void ExteriorCellRender::insertMesh(const std::string &mesh)
|
void ExteriorCellRender::insertMesh(const std::string &mesh)
|
||||||
{
|
{
|
||||||
assert (insert);
|
assert (insert);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "cellimp.hpp"
|
#include "cellimp.hpp"
|
||||||
|
|
||||||
#include "OgreColourValue.h"
|
#include "OgreColourValue.h"
|
||||||
|
#include <OgreMath.h>
|
||||||
|
|
||||||
namespace Ogre
|
namespace Ogre
|
||||||
{
|
{
|
||||||
|
@ -53,6 +54,7 @@ namespace MWRender
|
||||||
Ogre::SceneNode *base;
|
Ogre::SceneNode *base;
|
||||||
|
|
||||||
Ogre::SceneNode *insert;
|
Ogre::SceneNode *insert;
|
||||||
|
Ogre::SceneNode *npcPart;
|
||||||
|
|
||||||
// 0 normal, 1 more bright, 2 max
|
// 0 normal, 1 more bright, 2 max
|
||||||
int ambientMode;
|
int ambientMode;
|
||||||
|
@ -63,7 +65,9 @@ namespace MWRender
|
||||||
virtual void insertBegin (ESM::CellRef &ref);
|
virtual void insertBegin (ESM::CellRef &ref);
|
||||||
|
|
||||||
/// insert a mesh related to the most recent insertBegin call.
|
/// insert a mesh related to the most recent insertBegin call.
|
||||||
|
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);
|
virtual void insertMesh(const std::string &mesh);
|
||||||
|
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements);
|
||||||
|
|
||||||
/// insert a light related to the most recent insertBegin call.
|
/// insert a light related to the most recent insertBegin call.
|
||||||
virtual void insertLight(float r, float g, float b, float radius);
|
virtual void insertLight(float r, float g, float b, float radius);
|
||||||
|
@ -78,6 +82,7 @@ namespace MWRender
|
||||||
void configureFog();
|
void configureFog();
|
||||||
|
|
||||||
void setAmbientMode();
|
void setAmbientMode();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <OgreSceneNode.h>
|
#include <OgreSceneNode.h>
|
||||||
#include <OgreCamera.h>
|
#include <OgreCamera.h>
|
||||||
#include <OgreSceneManager.h>
|
#include <OgreSceneManager.h>
|
||||||
|
#include <OgreMath.h>
|
||||||
|
|
||||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||||
#include "mwscene.hpp"
|
#include "mwscene.hpp"
|
||||||
|
@ -58,6 +59,35 @@ void InteriorCellRender::insertBegin (ESM::CellRef &ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert a mesh related to the most recent insertBegin call.
|
// insert a mesh related to the most recent insertBegin call.
|
||||||
|
void InteriorCellRender::rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements)
|
||||||
|
{
|
||||||
|
assert(insert);
|
||||||
|
Ogre::SceneNode *parent = insert;
|
||||||
|
//std::cout << "ELEMENTS:" << elements;
|
||||||
|
for (int i = 0; i < elements; i++){
|
||||||
|
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||||
|
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||||
|
}
|
||||||
|
parent->rotate(axis, angle);
|
||||||
|
}
|
||||||
|
void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements){
|
||||||
|
|
||||||
|
assert (insert);
|
||||||
|
//insert->
|
||||||
|
Ogre::SceneNode *parent = insert;
|
||||||
|
for (int i = 0; i < elements; i++){
|
||||||
|
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||||
|
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||||
|
NIFLoader::load(mesh);
|
||||||
|
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||||
|
|
||||||
|
npcPart->translate(vec);
|
||||||
|
npcPart->rotate(axis, angle);
|
||||||
|
npcPart->attachObject(ent);
|
||||||
|
}
|
||||||
|
|
||||||
void InteriorCellRender::insertMesh(const std::string &mesh)
|
void InteriorCellRender::insertMesh(const std::string &mesh)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "cellimp.hpp"
|
#include "cellimp.hpp"
|
||||||
|
|
||||||
#include "OgreColourValue.h"
|
#include "OgreColourValue.h"
|
||||||
|
#include <OgreSceneNode.h>
|
||||||
|
|
||||||
namespace Ogre
|
namespace Ogre
|
||||||
{
|
{
|
||||||
|
@ -53,6 +54,7 @@ namespace MWRender
|
||||||
Ogre::SceneNode *base;
|
Ogre::SceneNode *base;
|
||||||
|
|
||||||
Ogre::SceneNode *insert;
|
Ogre::SceneNode *insert;
|
||||||
|
Ogre::SceneNode *npcPart;
|
||||||
|
|
||||||
// 0 normal, 1 more bright, 2 max
|
// 0 normal, 1 more bright, 2 max
|
||||||
int ambientMode;
|
int ambientMode;
|
||||||
|
@ -61,10 +63,10 @@ namespace MWRender
|
||||||
|
|
||||||
/// start inserting a new reference.
|
/// start inserting a new reference.
|
||||||
virtual void insertBegin (ESM::CellRef &ref);
|
virtual void insertBegin (ESM::CellRef &ref);
|
||||||
|
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements);
|
||||||
/// insert a mesh related to the most recent insertBegin call.
|
/// insert a mesh related to the most recent insertBegin call.
|
||||||
virtual void insertMesh(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);
|
||||||
/// insert a light related to the most recent insertBegin call.
|
/// insert a light related to the most recent insertBegin call.
|
||||||
virtual void insertLight(float r, float g, float b, float radius);
|
virtual void insertLight(float r, float g, float b, float radius);
|
||||||
|
|
||||||
|
@ -79,6 +81,7 @@ namespace MWRender
|
||||||
|
|
||||||
void setAmbientMode();
|
void setAmbientMode();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
|
|
Loading…
Reference in a new issue