forked from mirror/openmw-tes3mp
Physics working
This commit is contained in:
parent
b3e1044699
commit
15fcdc8b72
21 changed files with 32 additions and 27 deletions
|
@ -36,7 +36,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertActorPhysics(ptr);
|
||||
physics.insertActorPhysics(ptr, "meshes\\" + model);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertActorPhysics(ptr);
|
||||
physics.insertActorPhysics(ptr, "meshes\\" + model);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
|||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr);
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -183,15 +183,15 @@ namespace MWWorld
|
|||
throw std::logic_error ("can't find player");
|
||||
}
|
||||
|
||||
void PhysicsSystem::insertObjectPhysics(const MWWorld::Ptr& ptr){
|
||||
void PhysicsSystem::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string model){
|
||||
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||
addObject (node->getName(), node->getName(), node->getOrientation(),
|
||||
addObject (node->getName(), model, node->getOrientation(),
|
||||
node->getScale().x, node->getPosition());
|
||||
}
|
||||
|
||||
void PhysicsSystem::insertActorPhysics(const MWWorld::Ptr& ptr){
|
||||
void PhysicsSystem::insertActorPhysics(const MWWorld::Ptr& ptr, const std::string model){
|
||||
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||
addActor (node->getName(), node->getName(), node->getPosition());
|
||||
addActor (node->getName(), model, node->getPosition());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace MWWorld
|
|||
bool toggleCollisionMode();
|
||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
||||
|
||||
void insertObjectPhysics(const MWWorld::Ptr& ptr);
|
||||
void insertObjectPhysics(const MWWorld::Ptr& ptr, std::string model);
|
||||
|
||||
void insertActorPhysics(const MWWorld::Ptr& ptr);
|
||||
void insertActorPhysics(const MWWorld::Ptr&, std::string model);
|
||||
|
||||
private:
|
||||
OEngine::Render::OgreRenderer &mRender;
|
||||
|
|
|
@ -57,7 +57,6 @@ void insertCellRefList(MWRender::RenderingManager& rendering, MWWorld::Environme
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
rendering.addObject(ptr);
|
||||
class_.insertObject(ptr, physics, environment);
|
||||
class_.enable (ptr, environment);
|
||||
|
@ -101,14 +100,17 @@ namespace MWWorld
|
|||
|
||||
void Scene::loadCell (Ptr::CellStore *cell)
|
||||
{
|
||||
std::cout << "Start load\n";
|
||||
// register local scripts
|
||||
mWorld->getLocalScripts().addCell (cell);
|
||||
|
||||
// This connects the cell data with the rendering scene.
|
||||
mActiveCells.insert(cell);
|
||||
|
||||
mRendering.getObjects().buildStaticGeometry(*cell);
|
||||
std::cout << "Before static\n";
|
||||
|
||||
insertCell(*cell, mEnvironment);
|
||||
mRendering.getObjects().buildStaticGeometry(*cell);
|
||||
std::cout << "Done loading cell\n";
|
||||
|
||||
}
|
||||
|
||||
|
@ -228,6 +230,7 @@ namespace MWWorld
|
|||
|
||||
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
|
||||
{
|
||||
std::cout << "Changing to interior\n";
|
||||
// remove active
|
||||
CellStoreCollection::iterator active = mActiveCells.begin();
|
||||
|
||||
|
@ -309,7 +312,9 @@ void Scene::insertCell(ESMS::CellStore<MWWorld::RefData> &cell,
|
|||
MWWorld::Environment& environment)
|
||||
{
|
||||
// Loop through all references in the cell
|
||||
std::cout << "Reflist1\n";
|
||||
insertCellRefList(mRendering, environment, cell.activators, cell, *mPhysics);
|
||||
std::cout << "Reflist2\n";
|
||||
insertCellRefList(mRendering, environment, cell.potions, cell, *mPhysics);
|
||||
insertCellRefList(mRendering, environment, cell.appas, cell, *mPhysics);
|
||||
insertCellRefList(mRendering, environment, cell.armors, cell, *mPhysics);
|
||||
|
|
Loading…
Reference in a new issue