forked from teamnwah/openmw-tes3coop
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;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertActorPhysics(ptr);
|
physics.insertActorPhysics(ptr, "meshes\\" + model);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertActorPhysics(ptr);
|
physics.insertActorPhysics(ptr, "meshes\\" + model);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
if(!model.empty()){
|
||||||
physics.insertObjectPhysics(ptr);
|
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MWClass
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
if(!model.empty()){
|
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");
|
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();
|
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||||
addObject (node->getName(), node->getName(), node->getOrientation(),
|
addObject (node->getName(), model, node->getOrientation(),
|
||||||
node->getScale().x, node->getPosition());
|
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();
|
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();
|
bool toggleCollisionMode();
|
||||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
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:
|
private:
|
||||||
OEngine::Render::OgreRenderer &mRender;
|
OEngine::Render::OgreRenderer &mRender;
|
||||||
|
|
|
@ -57,7 +57,6 @@ void insertCellRefList(MWRender::RenderingManager& rendering, MWWorld::Environme
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
rendering.addObject(ptr);
|
rendering.addObject(ptr);
|
||||||
class_.insertObject(ptr, physics, environment);
|
class_.insertObject(ptr, physics, environment);
|
||||||
class_.enable (ptr, environment);
|
class_.enable (ptr, environment);
|
||||||
|
@ -101,14 +100,17 @@ namespace MWWorld
|
||||||
|
|
||||||
void Scene::loadCell (Ptr::CellStore *cell)
|
void Scene::loadCell (Ptr::CellStore *cell)
|
||||||
{
|
{
|
||||||
|
std::cout << "Start load\n";
|
||||||
// register local scripts
|
// register local scripts
|
||||||
mWorld->getLocalScripts().addCell (cell);
|
mWorld->getLocalScripts().addCell (cell);
|
||||||
|
|
||||||
// This connects the cell data with the rendering scene.
|
// This connects the cell data with the rendering scene.
|
||||||
mActiveCells.insert(cell);
|
mActiveCells.insert(cell);
|
||||||
|
std::cout << "Before static\n";
|
||||||
|
|
||||||
mRendering.getObjects().buildStaticGeometry(*cell);
|
|
||||||
insertCell(*cell, mEnvironment);
|
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)
|
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
|
||||||
{
|
{
|
||||||
|
std::cout << "Changing to interior\n";
|
||||||
// remove active
|
// remove active
|
||||||
CellStoreCollection::iterator active = mActiveCells.begin();
|
CellStoreCollection::iterator active = mActiveCells.begin();
|
||||||
|
|
||||||
|
@ -309,7 +312,9 @@ void Scene::insertCell(ESMS::CellStore<MWWorld::RefData> &cell,
|
||||||
MWWorld::Environment& environment)
|
MWWorld::Environment& environment)
|
||||||
{
|
{
|
||||||
// Loop through all references in the cell
|
// Loop through all references in the cell
|
||||||
|
std::cout << "Reflist1\n";
|
||||||
insertCellRefList(mRendering, environment, cell.activators, cell, *mPhysics);
|
insertCellRefList(mRendering, environment, cell.activators, cell, *mPhysics);
|
||||||
|
std::cout << "Reflist2\n";
|
||||||
insertCellRefList(mRendering, environment, cell.potions, cell, *mPhysics);
|
insertCellRefList(mRendering, environment, cell.potions, cell, *mPhysics);
|
||||||
insertCellRefList(mRendering, environment, cell.appas, cell, *mPhysics);
|
insertCellRefList(mRendering, environment, cell.appas, cell, *mPhysics);
|
||||||
insertCellRefList(mRendering, environment, cell.armors, cell, *mPhysics);
|
insertCellRefList(mRendering, environment, cell.armors, cell, *mPhysics);
|
||||||
|
|
Loading…
Reference in a new issue