Skip to content

Commit

Permalink
Checked for Mem leak , not corrected just noted MLK
Browse files Browse the repository at this point in the history
  • Loading branch information
rzr committed Jul 25, 2003
1 parent c7a37f5 commit c540121
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 221 deletions.
61 changes: 31 additions & 30 deletions base/AlignVisitor.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//#ident "$Id: AlignVisitor.cpp,v 1.5 2003/07/25 01:01:54 rzr Exp $"
/***************************************************************************
AlignVisitor.cpp - description
-------------------
begin : Wed Jan 26 2000
copyright : (C) 2000 by Henrik Enqvist
email : [email protected]
***************************************************************************/
***************************************************************************/

#include "Private.h"
#include "AlignVisitor.h"
Expand Down Expand Up @@ -42,21 +43,21 @@ AlignVisitor * AlignVisitor::getInstance() {
/* Clean up camera matrix. */
void AlignVisitor::empty() {
if (p_GroupCamera == NULL) return;
EM_COUT("AlignVisitor::empty()", 0);
// backward matrix multiplication for the camera
if (p_GroupCamera == NULL) {
return;
}
#if EM_USE_ALLEGRO
Matrix mtxTmp;
Matrix mtxScale = EMath::identityMatrix;
mtxScale.v[0][0] = 0.8;
mtxScale.v[1][1] = -0.6;
mtxScale.v[2][2] = -1;
EMath::matrixMulti(mtxScale, p_GroupCamera->m_mtxTrans, mtxTmp);
EMath::inverse(mtxTmp, m_mtxInverse);
Matrix mtxTmp;
Matrix mtxScale = EMath::identityMatrix;
mtxScale.v[0][0] = 0.8;
mtxScale.v[1][1] = -0.6;
mtxScale.v[2][2] = -1;
EMath::matrixMulti(mtxScale, p_GroupCamera->m_mtxTrans, mtxTmp);
EMath::inverse(mtxTmp, m_mtxInverse);
#else
EMath::inverse(p_GroupCamera->m_mtxTrans, m_mtxInverse);
#endif
Expand Down Expand Up @@ -84,12 +85,12 @@ void AlignVisitor::visit(Group * g) {
//vector<Vertex3D>::iterator nmlAlignEnd = (*shapeIter)->m_vNmlAlign.end();

EmAssert(((*shapeIter)->m_vVtxTrans.size () ==
(*shapeIter)->m_vVtxAlign.size ()) &&
((*shapeIter)->m_vNmlTrans.size () ==
(*shapeIter)->m_vNmlAlign.size ()), "size miss match");
(*shapeIter)->m_vVtxAlign.size ()) &&
((*shapeIter)->m_vNmlTrans.size () ==
(*shapeIter)->m_vNmlAlign.size ()), "size miss match");

for ( ; transIter != transEnd;
transIter++, alignIter++, nmlTransIter++, nmlAlignIter++) {
transIter++, alignIter++, nmlTransIter++, nmlAlignIter++) {
// Translation and rotation needs to be applied in wrong order
Vertex3D vtx;
vtx.x = (*transIter).x + m_mtxInverse.t[0];
Expand All @@ -102,25 +103,25 @@ void AlignVisitor::visit(Group * g) {
// TODO: optimize = macro instead of apply-fct calls, remove normalize

EM_COUT("AlignVisitor::visit() " <<
(*transIter).x <<" "<< (*transIter).y <<" "<< (*transIter).z <<" -> "<<
(*alignIter).x <<" "<< (*alignIter).y <<" "<< (*alignIter).z, 0);
(*transIter).x <<" "<< (*transIter).y <<" "<< (*transIter).z <<" -> "<<
(*alignIter).x <<" "<< (*alignIter).y <<" "<< (*alignIter).z, 0);
}
}
// Apply transform to BillBoard.
if (g->p_BillBoard != NULL) {
// Translation and rotation needs to be applied in wrong order
Vertex3D vtx;
Vertex3D vtx = { 0 , 0 , 0 } ; //!rzr UMR
vtx.x = g->p_BillBoard->m_vtxTrans.x + m_mtxInverse.t[0];
vtx.y = g->p_BillBoard->m_vtxTrans.y + m_mtxInverse.t[1];
vtx.z = g->p_BillBoard->m_vtxTrans.z + m_mtxInverse.t[2];
EMath::applyMatrixRot(m_mtxInverse, vtx, g->p_BillBoard->m_vtxAlign);
EM_COUT("AlignVisitor::visit() billboard " <<
g->p_BillBoard->m_vtxTrans.x <<" "<<
g->p_BillBoard->m_vtxTrans.y <<" "<<
g->p_BillBoard->m_vtxTrans.z <<" -> "<<
g->p_BillBoard->m_vtxAlign.x <<" "<<
g->p_BillBoard->m_vtxAlign.y <<" "<<
g->p_BillBoard->m_vtxAlign.z , 0);
g->p_BillBoard->m_vtxTrans.x <<" "<<
g->p_BillBoard->m_vtxTrans.y <<" "<<
g->p_BillBoard->m_vtxTrans.z <<" -> "<<
g->p_BillBoard->m_vtxAlign.x <<" "<<
g->p_BillBoard->m_vtxAlign.y <<" "<<
g->p_BillBoard->m_vtxAlign.z , 0);
}
// Apply transform to Light.
if (g->p_Light != NULL) {
Expand All @@ -132,13 +133,13 @@ void AlignVisitor::visit(Group * g) {
EMath::applyMatrixRot(m_mtxInverse, vtx, g->p_Light->m_vtxAlign);
}
// Apply transform to oSound.
// if (g->m_Sound != NULL) {
// EMath::applyMatrix(mtxCamera, g->m_Sound->vtxTrans, g->m_Sound->vtxAlign);
// }
// if (g->m_Sound != NULL) {
// EMath::applyMatrix(mtxCamera, g->m_Sound->vtxTrans, g->m_Sound->vtxAlign);
// }

// Apply transform to oNestedBounds.
// if (g->m_CollisionBounds != NULL) {
// this->visit(g->oNestedBounds);
// }
// Apply transform to oNestedBounds.
// if (g->m_CollisionBounds != NULL) {
// this->visit(g->oNestedBounds);
// }
}

3 changes: 2 additions & 1 deletion base/AmbientLightVisitor.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//#ident "$Id: AmbientLightVisitor.cpp,v 1.4 2003/07/25 01:01:54 rzr Exp $"
/***************************************************************************
AmbientLightVisitor.cpp - description
-------------------
Expand Down Expand Up @@ -202,7 +203,7 @@ void AmbientLightVisitor::visitPoint(Shape3D * s) {
((*lightIter)->m_iProperties & EM_USE_SPECULAR)) {
float specular;
Vertex3D vtxRef = {0.0f ,0.0f , -1.0f};
Vertex3D vtxDir;
Vertex3D vtxDir = {0.0f ,0.0f , 0.0f}; //!rzr UMR
vtxDir.x = (*vtxAlignIter).x - (*lightIter)->m_vtxAlign.x;
vtxDir.y = (*vtxAlignIter).y - (*lightIter)->m_vtxAlign.y;
vtxDir.z = (*vtxAlignIter).z - (*lightIter)->m_vtxAlign.z;
Expand Down
Loading

1 comment on commit c540121

@rzr
Copy link

@rzr rzr commented on c540121 Jan 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is in upstream base:

adoptware@95239f6

Relate-to: adoptware#15

Please sign in to comment.