|
From: <mk...@us...> - 2003-06-10 22:34:29
|
Update of /cvsroot/csp/THIRDPARTYLIBS/demeter
In directory sc8-pr-cvs1:/tmp/cvs-serv4635
Modified Files:
CHANGES.current Terrain.cpp TerrainTextureFactory.cpp
Log Message:
see CHANGES.current
Index: CHANGES.current
===================================================================
RCS file: /cvsroot/csp/THIRDPARTYLIBS/demeter/CHANGES.current,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CHANGES.current 18 Apr 2003 11:26:17 -0000 1.5
--- CHANGES.current 10 Jun 2003 22:34:26 -0000 1.6
***************
*** 2,5 ****
--- 2,9 ----
===========================
+ 2003-05-XX: onsight
+ Minor optimizations in texture generation. Still needs
+ its own thread.
+
2003-04-18: delta
Checked Onsight changes. got ride of some vc++ warnings.
Index: Terrain.cpp
===================================================================
RCS file: /cvsroot/csp/THIRDPARTYLIBS/demeter/Terrain.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Terrain.cpp 18 Apr 2003 11:26:17 -0000 1.6
--- Terrain.cpp 10 Jun 2003 22:34:26 -0000 1.7
***************
*** 694,697 ****
--- 694,701 ----
Terrain::Terrain(const char* szElevationsFilename,const char* szTextureFilename,const char* szDetailTextureFilename,float vertexSpacing,float elevationScale,int maxNumTriangles,bool bUseBorders,float offsetX,float offsetY,int numTexturesX,int numTexturesY)
{
+ if (numTexturesY == 3) {
+ char *c = 0;
+ *c++ = 0;
+ }
m_pCommonTexture = NULL;
m_pTriangleStrips = NULL;
***************
*** 712,715 ****
--- 716,720 ----
m_LatticePositionY = 0;
+ std::cout << "SetAllElevations " << szElevationsFilename << "\n";
SetAllElevations(szElevationsFilename,vertexSpacing,elevationScale);
***************
*** 824,827 ****
--- 829,834 ----
void Terrain::SetAllElevations(const char* szElevationsFilename,float vertexSpacing,float elevationScale)
{
+ std::cout << "SetAllElevations()\n";
+ std::cout << "efilename = " << szElevationsFilename << "\n";
bool useRaw = (strstr(szElevationsFilename, ".raw") || strstr(szElevationsFilename, ".RAW") );
***************
*** 3095,3098 ****
--- 3102,3107 ----
delete pTerrain;
m_pTextureFactory = NULL;
+ m_FactoryTilesWidth = 1;
+ m_FactoryTilesHeight = 1;
m_OffsetIndexX[Terrain::DIR_CENTER] = 0;
***************
*** 3153,3157 ****
m_FactoryTilesWidth = tilesWidth;
m_FactoryTilesHeight = tilesHeight;
-
}
--- 3162,3165 ----
***************
*** 3184,3187 ****
--- 3192,3198 ----
void TerrainLattice::AddTerrain(Terrain* pTerrain,int positionX,int positionY)
{
+ //std::cout << "ADDING TERRAIN " << positionX << " " << positionY << std::endl;
+ //char *c = 0;
+ //*c++ = 0;
m_pTerrains[positionY * m_WidthTerrains + positionX] = pTerrain;
pTerrain->SetLatticePosition(positionX,positionY);
Index: TerrainTextureFactory.cpp
===================================================================
RCS file: /cvsroot/csp/THIRDPARTYLIBS/demeter/TerrainTextureFactory.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TerrainTextureFactory.cpp 15 Feb 2003 20:56:19 -0000 1.3
--- TerrainTextureFactory.cpp 10 Jun 2003 22:34:26 -0000 1.4
***************
*** 35,39 ****
const float textureSize = 256.0f;
! float limit255(float a) //Check for invalid values
{
if(a < 0.0f) {
--- 35,39 ----
const float textureSize = 256.0f;
! inline float limit255(float a) //Check for invalid values
{
if(a < 0.0f) {
***************
*** 48,52 ****
}
! float texture_factor_low( float h1, float h2, float f)
{
if (f < h1)
--- 48,52 ----
}
! inline float texture_factor_low( float h1, float h2, float f)
{
if (f < h1)
***************
*** 59,63 ****
}
! float texture_factor_high( float h1, float h2, float f)
{
if (f < h1)
--- 59,63 ----
}
! inline float texture_factor_high( float h1, float h2, float f)
{
if (f < h1)
***************
*** 69,73 ****
}
! float texture_factor_mid2( float h1, float h2, float h3, float h4, float f)
{
if (f < h1)
--- 69,73 ----
}
! inline float texture_factor_mid2( float h1, float h2, float h3, float h4, float f)
{
if (f < h1)
***************
*** 86,90 ****
}
! float texture_factor_mid(float h1, float h2, float h3, float f) //Check for percentage of color
{
//float t;
--- 86,90 ----
}
! inline float texture_factor_mid(float h1, float h2, float h3, float f) //Check for percentage of color
{
//float t;
***************
*** 184,188 ****
if (Settings::GetInstance()->IsVerbose())
{
! m_Logfile << "Generating Texture" << endl;
}
--- 184,188 ----
if (Settings::GetInstance()->IsVerbose())
{
! m_Logfile << "Generating Texture" << latticeX << ":" << latticeY << endl;
}
***************
*** 205,213 ****
Uint8* pTex6 = m_BaseTextures[5];
Uint8* pImage = new Uint8[(int)((textureSize + 1.0f) * (textureSize + 1.0f)) * 3];
! int imageIndex = 0;
for (float y = originY; y < originY + height; y += texelSpacing)
{
! for (float x = originX; x < originX + width; x += texelSpacing,imageIndex += 3)
{
float f0, f1, f2, f3, f4, f5;
--- 205,216 ----
Uint8* pTex6 = m_BaseTextures[5];
+ //std::cout << "Generating Texture" << latticeX << ":" << latticeY << endl;
+ std::cout << originX << "," << originY << " " << width << "," << height << " " << textureSize << "\n";
+
Uint8* pImage = new Uint8[(int)((textureSize + 1.0f) * (textureSize + 1.0f)) * 3];
! Uint8* Idx = pImage;
for (float y = originY; y < originY + height; y += texelSpacing)
{
! for (float x = originX; x < originX + width; x += texelSpacing)
{
float f0, f1, f2, f3, f4, f5;
***************
*** 222,256 ****
Uint8 red = static_cast<unsigned char>(
! limit255(f0*pTex1[imageIndex] +
! f1*pTex2[imageIndex] +
! f2*pTex3[imageIndex] +
! f3*pTex4[imageIndex] +
! f4*pTex5[imageIndex] +
! f5*pTex6[imageIndex] )
);
Uint8 green = static_cast<unsigned char>(
! limit255(f0*pTex1[imageIndex + 1] +
! f1*pTex2[imageIndex + 1] +
! f2*pTex3[imageIndex + 1] +
! f3*pTex4[imageIndex + 1] +
! f4*pTex5[imageIndex + 1] +
! f5*pTex6[imageIndex + 1] )
);
Uint8 blue = static_cast<unsigned char>(
! limit255(f0*pTex1[imageIndex + 2] +
! f1*pTex2[imageIndex + 2] +
! f2*pTex3[imageIndex + 2] +
! f3*pTex4[imageIndex + 2] +
! f4*pTex5[imageIndex + 2] +
! f5*pTex6[imageIndex + 2] )
);
! pImage[imageIndex] = red;
! pImage[imageIndex + 1] = green;
! pImage[imageIndex + 2] = blue;
}
}
--- 225,259 ----
Uint8 red = static_cast<unsigned char>(
! limit255( f0 * *pTex1++ +
! f1 * *pTex2++ +
! f2 * *pTex3++ +
! f3 * *pTex4++ +
! f4 * *pTex5++ +
! f5 * *pTex6++ )
);
Uint8 green = static_cast<unsigned char>(
! limit255(f0 * *pTex1++ +
! f1 * *pTex2++ +
! f2 * *pTex3++ +
! f3 * *pTex4++ +
! f4 * *pTex5++ +
! f5 * *pTex6++ )
);
Uint8 blue = static_cast<unsigned char>(
! limit255(f0 * *pTex1++ +
! f1 * *pTex2++ +
! f2 * *pTex3++ +
! f3 * *pTex4++ +
! f4 * *pTex5++ +
! f5 * *pTex6++ )
);
! *Idx++ = red;
! *Idx++ = green;
! *Idx++ = blue;
}
}
|