port from perforce
This commit is contained in:
77
evoke-64k/trunk/ev10/cave.cpp
Normal file
77
evoke-64k/trunk/ev10/cave.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#include "cave.h"
|
||||
#include "globals.h"
|
||||
#include "meshdata/crystal.h"
|
||||
|
||||
#ifdef EXTRACODE
|
||||
int m_iCrystalCount;
|
||||
SCrystalInfo m_CrystalInfos[ m_iMaxCrystalCount ];
|
||||
#else
|
||||
#include "crystaldata.h"
|
||||
#endif
|
||||
|
||||
void CreateCaveRenderJobs()
|
||||
{
|
||||
|
||||
#ifdef CAVE
|
||||
#ifdef EXTRACODE
|
||||
OutputDebugString( "Creating cave: \n" );
|
||||
DWORD dwTicks = GetTickCount();
|
||||
#endif
|
||||
|
||||
g_CaveTerrainGrid.Init( 192, 96, &TerrainGrid::IsoSurfaceCave );
|
||||
g_CaveGroundTerrainGrid.Init( 96, 48, &TerrainGrid::IsoSurfaceCaveGround );
|
||||
|
||||
#ifdef EXTRACODE
|
||||
char cTime[128];
|
||||
dwTicks = GetTickCount() - dwTicks;
|
||||
sprintf_s( cTime, "Time: %d \n", dwTicks );
|
||||
OutputDebugString( cTime );
|
||||
#endif
|
||||
|
||||
D3DXMATRIX matTerrainWorld, matTerrainPos;
|
||||
D3DXMatrixScaling(&matTerrainWorld, 128, 32, 128);
|
||||
D3DXMatrixTranslation(&matTerrainPos, -64, -16, -64);
|
||||
D3DXMatrixMultiply(&matTerrainWorld, &matTerrainWorld, &matTerrainPos);
|
||||
|
||||
g_Objects[ OI_CAVE_FIRST ].m_iUsedPreShader = PreDepth;
|
||||
g_Objects[ OI_CAVE_FIRST ].m_iUsedShader[ 0 ] = Cave;
|
||||
g_Objects[ OI_CAVE_FIRST ].SetTransformation(matTerrainWorld);
|
||||
g_Objects[ OI_CAVE_FIRST ].m_pTerrain = &g_CaveTerrainGrid;
|
||||
|
||||
D3DXMatrixScaling(&matTerrainWorld, 128, 16, 128);
|
||||
D3DXMatrixTranslation(&matTerrainPos, -64, -24, -64);
|
||||
D3DXMatrixMultiply(&matTerrainWorld, &matTerrainWorld, &matTerrainPos);
|
||||
|
||||
g_Objects[ OI_CAVE_GROUND_FIRST].m_iUsedPreShader = PreDepth;
|
||||
g_Objects[ OI_CAVE_GROUND_FIRST ].m_iUsedShader[ 0 ] = CaveGround;
|
||||
g_Objects[ OI_CAVE_GROUND_FIRST ].SetTransformation(matTerrainWorld);
|
||||
g_Objects[ OI_CAVE_GROUND_FIRST ].m_pTerrain = &g_CaveGroundTerrainGrid;
|
||||
#else
|
||||
#endif
|
||||
|
||||
SetCrystalPos();
|
||||
}
|
||||
|
||||
void SetCrystalPos()
|
||||
{
|
||||
for(int i= 0; i < m_iCrystalCount; ++i )
|
||||
{
|
||||
assert( OI_CAVE_LIGHT_FIRST + i <= OI_CAVE_LIGHT_LAST );
|
||||
Renderjob* pRJ= g_Objects + OI_CAVE_LIGHT_FIRST + i;
|
||||
CreateCrystal( *pRJ );
|
||||
pRJ->m_iUsedPreShader= PreDepth;
|
||||
pRJ->m_iUsedShader[ 0 ]= Crystal;
|
||||
|
||||
SCrystalInfo& ci= m_CrystalInfos[ i ];
|
||||
|
||||
D3DXMATRIX matResult;
|
||||
D3DXMATRIX mat;
|
||||
D3DXMatrixScaling( &matResult, ci.m_fScale, ci.m_fScale, ci.m_fScale );
|
||||
D3DXMatrixRotationYawPitchRoll( &mat, ci.m_v3Rot.x, ci.m_v3Rot.y, ci.m_v3Rot.z );
|
||||
D3DXMatrixMultiply( &matResult,&matResult,&mat);
|
||||
D3DXMatrixTranslation( &mat, ci.m_v3Pos.x, ci.m_v3Pos.y, ci.m_v3Pos.z );
|
||||
D3DXMatrixMultiply( &matResult,&matResult,&mat);
|
||||
|
||||
pRJ->SetTransformation( matResult );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user