Hi Bitplane !
(I thank you to having told me about that QuadTree node
But I have still quesitons about it, I'll tell you about that later if you do accept )
1) For the color, I use :
Code: Select all
const SColor COLOR_AXIS_X = SColor(255, 255, 0, 0);
const SColor COLOR_AXIS_Y = SColor(255, 0, 255, 0);
const SColor COLOR_AXIS_Z = SColor(255, 0, 0, 255);
const SColor COLOR_BOUNDING_BOX = SColor(255, 255, 255, 255);
void CInGameScreen::preEnvDrawScreen()
{
// Defines
hotp->driver->draw3DLine(vector3df(0, 0, 0), vector3df(AXIS_LENGTH, 0, 0), COLOR_AXIS_X);
hotp->driver->draw3DLine(vector3df(0, 0, 0), vector3df(0, AXIS_LENGTH, 0), COLOR_AXIS_Y);
hotp->driver->draw3DLine(vector3df(0, 0, 0), vector3df(0, 0, AXIS_LENGTH), COLOR_AXIS_Z);
// In ctor()
material.Lighting = false;
material.DiffuseColor = video::SColor( 255, 255, 255, 255 );
//
// All that follows is in a post world-rendering function (called after scene->drawAll();)
//
// Pitga is a pointer to the selected object (a tree or an experience shrine atm)
// In fact, I put objects on the map with left click, and select an object with right click
// Here I draw the origin (thats why I can see that the origin changed)
hotp->driver->draw3DLine(vector3df(0, 0, 0), vector3df(AXIS_LENGTH, 0, 0), COLOR_AXIS_X);
hotp->driver->draw3DLine(vector3df(0, 0, 0), vector3df(0, AXIS_LENGTH, 0), COLOR_AXIS_Y);
hotp->driver->draw3DLine(vector3df(0, 0, 0), vector3df(0, 0, AXIS_LENGTH), COLOR_AXIS_Z);
// Here I draw the base square of the selected object (to show that it is selected). This is here that I can also see the origin change, and that the white colour does not work
if (ptiga != NULL)
{
vector3df _edges[8];
core::aabbox3d<f32> bb = ptiga->getBoundingBox();
vector3df pos = ptiga->getAbsolutePosition();
bb.getEdges(&_edges[0]);
vector3df elevation = vector3df(0, 0.1, 0);
for (int i = 0; i < 8; ++i)
_edges[i] += pos + elevation;
hotp->driver->draw3DLine(_edges[0], _edges[2], COLOR_BOUNDING_BOX);
hotp->driver->draw3DLine(_edges[2], _edges[6], COLOR_BOUNDING_BOX);
hotp->driver->draw3DLine(_edges[6], _edges[4], COLOR_BOUNDING_BOX);
hotp->driver->draw3DLine(_edges[4], _edges[0], COLOR_BOUNDING_BOX);
}
}
2) For the origin change when I place an object...
I tried with another object (the experience shrine), using the
addOctTreeSceneNode() function, and the same thing happened.
When I use the QuadTree instead, there are two behaviours :
If I use the "startAdding" and "endAdding" functions everytime I add an object, the origin change happens VERY OFTEN. If I do not use these functions, it does happen like I told in my previous post.
Strange, he ?
I also remarked another thing (just right now, because Im doing tests while writing this answer) : I have 3 objects types in my editor atm :
a ridiculous tree with "transparent" textures (that do not work lol), a less ridiculous tree, that I use for my tests, and an experience shrine (that does not draw its selection square... Strange !).
When I add the
FIRST instance of each kind, it changes the origin to the position of that new node. Then its not doing this when I add the first object in the world, but the first of each type.
Maybe is my "origin drawing" code not good ? I hope no. But if it is good, then where is the error ?
If you need the project I can upload it somwhere, with the sources, and you will just have to compile.
If not, I hope that what I told in this answer will let you understand why it is doing this origin change...
For the white color (that is drawed as Red instead), I do not care a lot, but the origin change is more... huuu... "bad" for me ("problematic" ?)
Thank you a lot, and do not hesitate if you need the whole project.