Fixed CoordinateFrame
This commit is contained in:
@@ -380,13 +380,17 @@ void PartInstance::render(RenderDevice* rd) {
|
|||||||
}
|
}
|
||||||
changed=false;
|
changed=false;
|
||||||
}
|
}
|
||||||
|
//rd->setObjectToWorldMatrix(cFrame);
|
||||||
|
CoordinateFrame forDraw = rd->getObjectToWorldMatrix();
|
||||||
|
rd->setObjectToWorldMatrix(cFrame);
|
||||||
glVertexPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[0]);
|
glVertexPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[0]);
|
||||||
glColorPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[3]);
|
glColorPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[3]);
|
||||||
glNormalPointer(GL_FLOAT,3 * sizeof(GLfloat), &_normals[0]);
|
glNormalPointer(GL_FLOAT,3 * sizeof(GLfloat), &_normals[0]);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x,position.y,position.z);
|
//glTranslatef(2,7,0);
|
||||||
glDrawElements(GL_TRIANGLES, _indices.size(), GL_UNSIGNED_SHORT, &_indices[0]);
|
glDrawElements(GL_TRIANGLES, _indices.size(), GL_UNSIGNED_SHORT, &_indices[0]);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
rd->setObjectToWorldMatrix(forDraw);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void PartInstance::render(RenderDevice* rd)
|
void PartInstance::render(RenderDevice* rd)
|
||||||
|
|||||||
39
main.cpp
39
main.cpp
@@ -1084,6 +1084,7 @@ void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters
|
|||||||
|
|
||||||
if(mode == ARROWS)
|
if(mode == ARROWS)
|
||||||
{
|
{
|
||||||
|
glScalef(2,2,2);
|
||||||
rd->setLight(0, NULL);
|
rd->setLight(0, NULL);
|
||||||
rd->setAmbientLightColor(Color3(1,1,1));
|
rd->setAmbientLightColor(Color3(1,1,1));
|
||||||
|
|
||||||
@@ -1091,23 +1092,24 @@ void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters
|
|||||||
c.toWorldSpace(Box(from, to)).getBounds(box);
|
c.toWorldSpace(Box(from, to)).getBounds(box);
|
||||||
float max = box.high().y - pos.y;
|
float max = box.high().y - pos.y;
|
||||||
|
|
||||||
Draw::arrow(pos, Vector3(0, 1.5+max, 0), rd);
|
Draw::arrow(pos/2, Vector3(0, 1.5+max, 0), rd);
|
||||||
Draw::arrow(pos, Vector3(0, (-1.5)-max, 0), rd);
|
Draw::arrow(pos/2, Vector3(0, (-1.5)-max, 0), rd);
|
||||||
|
|
||||||
max = box.high().x - pos.x;
|
max = box.high().x - pos.x;
|
||||||
|
|
||||||
Draw::arrow(pos, Vector3(1.5+max, 0, 0), rd);
|
Draw::arrow(pos/2, Vector3(1.5+max, 0, 0), rd);
|
||||||
Draw::arrow(pos, Vector3((-1.5)-max, 0, 0), rd);
|
Draw::arrow(pos/2, Vector3((-1.5)-max, 0, 0), rd);
|
||||||
|
|
||||||
max = box.high().z - pos.z;
|
max = box.high().z - pos.z;
|
||||||
|
|
||||||
Draw::arrow(pos, Vector3(0, 0, 1.5+max), rd);
|
Draw::arrow(pos/2, Vector3(0, 0, 1.5+max), rd);
|
||||||
Draw::arrow(pos, Vector3(0, 0, (-1.5)-max), rd);
|
Draw::arrow(pos/2, Vector3(0, 0, (-1.5)-max), rd);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rd->setAmbientLightColor(lighting.ambient);
|
rd->setAmbientLightColor(lighting.ambient);
|
||||||
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
|
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
|
||||||
|
glScalef(1,1,1);
|
||||||
}
|
}
|
||||||
else if(mode == RESIZE)
|
else if(mode == RESIZE)
|
||||||
{
|
{
|
||||||
@@ -1119,24 +1121,23 @@ void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters
|
|||||||
float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
|
float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
|
||||||
if(distance < 200)
|
if(distance < 200)
|
||||||
{
|
{
|
||||||
|
|
||||||
float multiplier = distance * 0.025F/2;
|
float multiplier = distance * 0.025F/2;
|
||||||
if(multiplier < 0.25F)
|
if(multiplier < 0.25F)
|
||||||
multiplier = 0.25F;
|
multiplier = 0.25F;
|
||||||
Vector3 position = pos + (c.lookVector()*((size.z/2)+1));
|
Vector3 position = pos + (c.lookVector()*((size.z)+2));
|
||||||
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
Draw::sphere(Sphere(position, multiplier*2), rd, sphereColor, Color4::clear());
|
||||||
position = pos - (c.lookVector()*((size.z/2)+1));
|
position = pos - (c.lookVector()*((size.z)+2));
|
||||||
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
Draw::sphere(Sphere(position, multiplier*2), rd, sphereColor, Color4::clear());
|
||||||
|
|
||||||
position = pos + (c.rightVector()*((size.x/2)+1));
|
position = pos + (c.rightVector()*((size.x)+2));
|
||||||
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
Draw::sphere(Sphere(position, multiplier*2), rd, sphereColor, Color4::clear());
|
||||||
position = pos - (c.rightVector()*((size.x/2)+1));
|
position = pos - (c.rightVector()*((size.x)+2));
|
||||||
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
Draw::sphere(Sphere(position, multiplier*2), rd, sphereColor, Color4::clear());
|
||||||
|
|
||||||
position = pos + (c.upVector()*((size.y/2)+1));
|
position = pos + (c.upVector()*((size.y)+2));
|
||||||
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
Draw::sphere(Sphere(position, multiplier*2), rd, sphereColor, Color4::clear());
|
||||||
position = pos - (c.upVector()*((size.y/2)+1));
|
position = pos - (c.upVector()*((size.y)+2));
|
||||||
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
Draw::sphere(Sphere(position, multiplier*2), rd, sphereColor, Color4::clear());
|
||||||
}
|
}
|
||||||
rd->setAmbientLightColor(lighting.ambient);
|
rd->setAmbientLightColor(lighting.ambient);
|
||||||
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
|
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
|
||||||
|
|||||||
Reference in New Issue
Block a user