Ignore:
Timestamp:
04/01/07 00:02:16 (17 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/pathmap/TexturedMaterial.cpp

    r2197 r2304  
    22#include "texturedmaterial.h" 
    33 
    4 TexturedMaterial::TexturedMaterial(void* pdata, int pitch, int textureSize) 
     4TexturedMaterial::TexturedMaterial(void* pdata, int pitch, int textureWidth, int textureHeight) 
    55:Material(Vector::RGBLIGHTYELLOW, Vector::RGBLIGHTYELLOW, 4.0) 
    66{ 
    7         this->pdata = new unsigned char[pitch * textureSize]; 
    8         memcpy(this->pdata, pdata, pitch * textureSize); 
     7        this->pdata = new unsigned char[pitch * textureHeight]; 
     8        memcpy(this->pdata, pdata, pitch * textureHeight); 
    99        this->pitch = pitch; 
    10         this->imageSize = textureSize; 
     10        this->imageWidth = textureWidth; 
     11        this->imageHeight = textureHeight; 
    1112} 
    1213 
     
    2122        qp.x -= floor(qp.x); 
    2223        qp.y -= floor(qp.y); 
    23         unsigned int dataIndex = floor(fabsf(qp.x) * imageSize) * 4 + 
    24                 floor(fabsf(1.0 - fabsf(qp.y)) * imageSize) * pitch; 
    25         if(dataIndex >= pitch * imageSize) 
     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) 
    2627                return Vector::RGBBLACK; 
    2728        return Vector( 
Note: See TracChangeset for help on using the changeset viewer.