Changeset 2304 for GTP/trunk/App/Demos/Illum/pathmap/TexturedMaterial.cpp
- Timestamp:
- 04/01/07 00:02:16 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/pathmap/TexturedMaterial.cpp
r2197 r2304 2 2 #include "texturedmaterial.h" 3 3 4 TexturedMaterial::TexturedMaterial(void* pdata, int pitch, int texture Size)4 TexturedMaterial::TexturedMaterial(void* pdata, int pitch, int textureWidth, int textureHeight) 5 5 :Material(Vector::RGBLIGHTYELLOW, Vector::RGBLIGHTYELLOW, 4.0) 6 6 { 7 this->pdata = new unsigned char[pitch * texture Size];8 memcpy(this->pdata, pdata, pitch * texture Size);7 this->pdata = new unsigned char[pitch * textureHeight]; 8 memcpy(this->pdata, pdata, pitch * textureHeight); 9 9 this->pitch = pitch; 10 this->imageSize = textureSize; 10 this->imageWidth = textureWidth; 11 this->imageHeight = textureHeight; 11 12 } 12 13 … … 21 22 qp.x -= floor(qp.x); 22 23 qp.y -= floor(qp.y); 23 unsigned int dataIndex = floor(fabsf(qp.x) * image Size) * 4 +24 floor(fabsf(1.0 - fabsf(qp.y)) * image Size) * pitch;25 if(dataIndex >= pitch * image Size)24 unsigned int dataIndex = floor(fabsf(qp.x) * imageWidth) * 4 + 25 floor(fabsf(1.0 - fabsf(qp.y)) * imageHeight) * pitch; 26 if(dataIndex >= pitch * imageHeight) 26 27 return Vector::RGBBLACK; 27 28 return Vector(
Note: See TracChangeset
for help on using the changeset viewer.