Skip to content

Commit

Permalink
Store the entity inside the planet
Browse files Browse the repository at this point in the history
setEntity created
  • Loading branch information
giogix2 committed Aug 15, 2016
1 parent 3bb6505 commit 48847a1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
23 changes: 16 additions & 7 deletions PSphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,22 +785,31 @@ void PSphere::attachMeshOnGround(Ogre::SceneNode *node, Ogre::SceneManager *scen

void PSphere::attachAstroChild(PSphere *object)
{
string objectMeshName = object->getMeshName();
string objectTextName = object->getTextureName();

astroObjectsChild.push_back(object);
Ogre::SceneNode* nodeObject;
nodeObject = object->getNode();
string nodeObjectName = nodeObject->getName();
string secNodeName = "sec_node_";
secNodeName = secNodeName+nodeObjectName;
Ogre::SceneNode *nodeSecondary = this->node->createChildSceneNode(secNodeName);

// Ogre::SceneNode* nodeObject;
// nodeObject = object->getNode();
// string nodeObjectName = nodeObject->getName();
// string secNodeName = "sec_node_";
// secNodeName = secNodeName+nodeObjectName;
// Ogre::SceneNode *nodeSecondary = this->node->createChildSceneNode(secNodeName);
// nodeSecondary->addChild(nodeObject);
nodeSecondary->createChildSceneNode(nodeObjectName);
// nodeSecondary->createChildSceneNode(nodeObjectName);
}

void PSphere::setNode(Ogre::SceneNode *node)
{
this->node = node;
}

void PSphere::setEntity(Ogre::Entity *entity)
{
this->entity = entity;
}

Ogre::SceneNode* PSphere::getNode()
{
return node;
Expand Down
3 changes: 3 additions & 0 deletions PSphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class PSphere

void setNode(Ogre::SceneNode *node);

void setEntity(Ogre::Entity *entity);

Ogre::SceneNode* getNode();

void moveObject(const std::string &objectName, int direction, float pace);
Expand Down Expand Up @@ -133,6 +135,7 @@ class PSphere
Ogre::Real radius;
Ogre::Real seaHeight;
Ogre::SceneNode *node;
Ogre::Entity *entity;
unsigned char *surfaceTexture;
unsigned short surfaceTextureWidth;
unsigned short surfaceTextureHeight;
Expand Down
7 changes: 4 additions & 3 deletions initOgre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,16 @@ void initOgre::setSceneAndRun(PSphere *planet){
mySphere2 = new PSphere(100, 40, 1024, 512, *params2);
mySphere2->loadToBuffers("CustomMesh2", "sphereTex2");

// Ogre::Entity *entity2 = Scene->createEntity("CustomEntity2", "CustomMesh2");
//// Ogre::SceneNode *nodeSphere2 = Scene->getRootSceneNode()->createChildSceneNode("planetSphere2");
Ogre::Entity *entity2 = Scene->createEntity("CustomEntity2", "CustomMesh2");
// Ogre::SceneNode *nodeSphere2 = Scene->getRootSceneNode()->createChildSceneNode("planetSphere2");
// Ogre::SceneNode *nodeSphere2 = Scene->createSceneNode("planetSphere2");
// nodeSphere2->attachObject(entity2);

// nodeSphere2->setPosition(-20.0f, 0.0f, -0.0f);
// nodeSphere2->setOrientation(0.0f, -0.0f, -0.0f, -0.9144643269f);

// mySphere2->setNode(nodeSphere2);
// mySphere2->setEntity(entity2);

// Ogre::MaterialPtr textureMap2 = Ogre::MaterialManager::getSingleton()
// .create("TextureObject",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Expand All @@ -205,7 +206,7 @@ void initOgre::setSceneAndRun(PSphere *planet){
// // Set texture for the sphere
// entity2->setMaterial(textureMap2);

// planet->attachAstroChild(mySphere2);
planet->attachAstroChild(mySphere2);
// ########################################################################################

/********************************************************************************
Expand Down

0 comments on commit 48847a1

Please sign in to comment.