don't pass width/height into renderObject

This commit is contained in:
Erwin Coumans 2016-06-07 17:02:47 -07:00
parent d2e50d045b
commit e0c3392cee
7 changed files with 10 additions and 7 deletions

View File

@ -363,7 +363,7 @@ void TinyRendererSetup::stepSimulation(float deltaTime)
} }
} }
TinyRenderer::renderObject(*m_internalData->m_renderObjects[o], m_internalData->m_width,m_internalData->m_height); TinyRenderer::renderObject(*m_internalData->m_renderObjects[o]);
} }
//m_app->drawText("hello",500,500); //m_app->drawText("hello",500,500);
render->activateTexture(m_internalData->m_textureHandle); render->activateTexture(m_internalData->m_textureHandle);

View File

@ -576,7 +576,7 @@ void TinyRendererVisualShapeConverter::render(const float viewMat[16], const flo
renderObj->m_lightDirWorld = lightDirWorld; renderObj->m_lightDirWorld = lightDirWorld;
} }
} }
TinyRenderer::renderObject(*renderObj,m_data->m_swWidth,m_data->m_swHeight); TinyRenderer::renderObject(*renderObj);
} }
} }
//printf("write tga \n"); //printf("write tga \n");

View File

@ -110,7 +110,7 @@ public:
int shapeIndex = OpenGLGuiHelper::registerGraphicsShape(vertices,numvertices,indices,numIndices); int shapeIndex = OpenGLGuiHelper::registerGraphicsShape(vertices,numvertices,indices,numIndices);
if (shapeIndex>=0) if (shapeIndex>=0)
{ {
TinyRenderObjectData* swObj = new TinyRenderObjectData(m_swWidth,m_swHeight,m_rgbColorBuffer,m_depthBuffer); TinyRenderObjectData* swObj = new TinyRenderObjectData(m_rgbColorBuffer,m_depthBuffer);
float rgbaColor[4] = {1,1,1,1}; float rgbaColor[4] = {1,1,1,1};
swObj->registerMeshShape(vertices,numvertices,indices,numIndices,rgbaColor); swObj->registerMeshShape(vertices,numvertices,indices,numIndices,rgbaColor);
//swObj->createCube(1,1,1);//MeshShape(vertices,numvertices,indices,numIndices); //swObj->createCube(1,1,1);//MeshShape(vertices,numvertices,indices,numIndices);

View File

@ -253,7 +253,7 @@ struct TinyRendererGUIHelper : public GUIHelperInterface
{ {
int shapeIndex = m_swRenderObjects.size(); int shapeIndex = m_swRenderObjects.size();
TinyRenderObjectData* swObj = new TinyRenderObjectData(m_swWidth,m_swHeight,m_rgbColorBuffer,m_depthBuffer); TinyRenderObjectData* swObj = new TinyRenderObjectData(m_rgbColorBuffer,m_depthBuffer);
float rgbaColor[4] = {1,1,1,1}; float rgbaColor[4] = {1,1,1,1};
swObj->registerMeshShape(vertices,numvertices,indices,numIndices,rgbaColor); swObj->registerMeshShape(vertices,numvertices,indices,numIndices,rgbaColor);
//swObj->createCube(1,1,1);//MeshShape(vertices,numvertices,indices,numIndices); //swObj->createCube(1,1,1);//MeshShape(vertices,numvertices,indices,numIndices);

View File

@ -231,8 +231,11 @@ TinyRenderObjectData::~TinyRenderObjectData()
delete m_model; delete m_model;
} }
void TinyRenderer::renderObject(TinyRenderObjectData& renderData, int width, int height) void TinyRenderer::renderObject(TinyRenderObjectData& renderData)
{ {
int width = renderData.m_rgbColorBuffer.get_width();
int height = renderData.m_rgbColorBuffer.get_height();
Vec3f light_dir_local = Vec3f(renderData.m_lightDirWorld[0],renderData.m_lightDirWorld[1],renderData.m_lightDirWorld[2]); Vec3f light_dir_local = Vec3f(renderData.m_lightDirWorld[0],renderData.m_lightDirWorld[1],renderData.m_lightDirWorld[2]);
Model* model = renderData.m_model; Model* model = renderData.m_model;
if (0==model) if (0==model)

View File

@ -47,7 +47,7 @@ struct TinyRenderObjectData
class TinyRenderer class TinyRenderer
{ {
public: public:
static void renderObject(TinyRenderObjectData& renderData, int width, int height); static void renderObject(TinyRenderObjectData& renderData);
}; };
#endif // TINY_RENDERER_Hbla #endif // TINY_RENDERER_Hbla

View File

@ -86,7 +86,7 @@ int main(int argc, char* argv[])
b3AlignedObjectArray<float> depthBuffer; b3AlignedObjectArray<float> depthBuffer;
depthBuffer.resize(gWidth*gHeight); depthBuffer.resize(gWidth*gHeight);
TinyRenderObjectData renderData(textureWidth, textureHeight,rgbColorBuffer,depthBuffer);//, "african_head/african_head.obj");//floor.obj"); TinyRenderObjectData renderData(rgbColorBuffer,depthBuffer);//, "african_head/african_head.obj");//floor.obj");
//renderData.loadModel("african_head/african_head.obj"); //renderData.loadModel("african_head/african_head.obj");
renderData.loadModel("floor.obj"); renderData.loadModel("floor.obj");