removed some non used code

This commit is contained in:
Pawel Kolodziejski 2005-01-11 19:46:47 +00:00
parent ecf71e48dd
commit d54c39ec12
3 changed files with 10 additions and 119 deletions

View file

@ -49,7 +49,6 @@ void Driver::setupCamera(float fov, float nclip, float fclip, float roll) {
// Set perspective transformation
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//gluPerspective(std::atan(std::tan(fov_ / 2 * (M_PI / 180)) * 0.75) * 2 * (180 / M_PI), 4.0f / 3, nclip_, fclip_);
float right = nclip * std::tan(fov / 2 * (M_PI / 180));
glFrustum(-right, right, -right * 0.75, right * 0.75, nclip, fclip);
@ -99,81 +98,6 @@ void Driver::set3DMode() {
glEnable(GL_DEPTH_TEST);
}
void Driver::drawModelNodeDebug(const Model::Mesh *model) {
// debug
// this draw the model node in red
GLdouble modelView[500];
GLdouble projection[500];
GLint viewPort[500];
glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
glGetDoublev(GL_PROJECTION_MATRIX, projection);
glGetIntegerv(GL_VIEWPORT, viewPort);
glPushMatrix();
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glPointSize(3.f);
glColor4f(1.f, 0.f, 0.f, 1.f);
glDisable(GL_TEXTURE_2D);
glBegin(GL_POINTS);
glVertex3f(model->_matrix._pos.x(), model->_matrix._pos.y(), model->_matrix._pos.z());
glEnd();
glEnable(GL_DEPTH_TEST);
glPopMatrix();
glEnable(GL_TEXTURE_2D);
}
void Driver::drawModelPolygonPointsDebug(const Model::Mesh *model) {
// debug
// this draw the poly points
GLdouble modelView[500];
GLdouble projection[500];
GLint viewPort[500];
int i, j;
glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
glGetDoublev(GL_PROJECTION_MATRIX, projection);
glGetIntegerv(GL_VIEWPORT, viewPort);
glPushMatrix();
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glPointSize(3.f);
glColor4f(0.f, 1.f, 0.f, 1.f);
glDisable(GL_TEXTURE_2D);
glBegin(GL_POINTS);
for (i = 0; i < model->_numFaces; i++) {
Vector3d v;
Matrix4 tempMatrix = model->_matrix;
float *pVertices;
for (j = 0; j < model->_faces[i]._numVertices; j++) {
pVertices = model->_vertices + 3 * model->_faces[i]._vertices[j];
v.set(*(pVertices), *(pVertices + 1), *(pVertices + 2));
// tempMatrix._rot.transform(&v);
v += tempMatrix._pos;
glVertex3f(v.x(), v.y(), v.z());
}
}
glEnd();
glEnable(GL_DEPTH_TEST);
glPopMatrix();
glEnable(GL_TEXTURE_2D);
}
void Driver::drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) {
glNormal3fv(face->_normal._coords);
glBegin(GL_POLYGON);
@ -217,36 +141,6 @@ void Driver::drawHierachyNode(const Model::HierNode *node) {
node->_sibling->draw();
}
void Driver::updateHierachyNode1(const Model::HierNode *node) {
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(node->_animPos.x() / node->_totalWeight, node->_animPos.y() / node->_totalWeight, node->_animPos.z() / node->_totalWeight);
glRotatef(node->_animYaw / node->_totalWeight, 0, 0, 1);
glRotatef(node->_animPitch / node->_totalWeight, 1, 0, 0);
glRotatef(node->_animRoll / node->_totalWeight, 0, 1, 0);
}
void Driver::updateHierachyNode2(const Model::HierNode *node) {
if (node->_mesh != NULL) {
glPushMatrix();
glTranslatef(node->_pivot.x(), node->_pivot.y(), node->_pivot.z());
node->_mesh->_matrix = node->_pivotMatrix;
node->_mesh->update();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}
if (node->_child != NULL ) {
node->_child->setMatrix(node->_matrix);
node->_child->update();
glMatrixMode(GL_MODELVIEW);
}
glPopMatrix();
}
void Driver::createBitmap(Bitmap *bitmap) {
if (bitmap->_format == 1) {
bitmap->_hasTransparency = false;

View file

@ -43,12 +43,7 @@ public:
void set3DMode();
void drawHierachyNode(const Model::HierNode *node);
void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);
void drawModelNodeDebug(const Model::Mesh *model);
void drawModelPolygonPointsDebug(const Model::Mesh *model);
void updateHierachyNode1(const Model::HierNode *node);
void updateHierachyNode2(const Model::HierNode *node);
void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);
void createMaterial(Material *material, const char *data, const CMap *cmap);
void selectMaterial(const Material *material);

View file

@ -435,8 +435,6 @@ void Model::HierNode::setMatrix(Matrix4 matrix) {
}
void Model::HierNode::update() {
g_driver->updateHierachyNode1(this);
_localMatrix._pos.set(_animPos.x() / _totalWeight, _animPos.y() / _totalWeight, _animPos.z() / _totalWeight);
_localMatrix._rot.buildFromPitchYawRoll(_animPitch / _totalWeight, _animYaw / _totalWeight, _animRoll / _totalWeight);
@ -444,17 +442,21 @@ void Model::HierNode::update() {
_pivotMatrix = _matrix;
_pivotMatrix.translate(_pivot.x(), _pivot.y(), _pivot.z() );
_pivotMatrix.translate(_pivot.x(), _pivot.y(), _pivot.z());
g_driver->updateHierachyNode2(this);
if (_mesh != NULL ) {
_mesh->_matrix = _pivotMatrix;
}
if (_child != NULL) {
_child->setMatrix(_matrix);
_child->update();
}
}
void Model::Mesh::draw() const {
for (int i = 0; i < _numFaces; i++)
_faces[i].draw(_vertices, _vertNormals, _textureVerts);
// g_driver->drawModelNodeDebug(this);
// g_driver->drawModelPolygonPointsDebug(this);
}
void Model::Face::draw(float *vertices, float *vertNormals, float *textureVerts) const {