RTRenderer.cpp
上传用户:kairuinn
上传日期:2009-02-07
资源大小:2922k
文件大小:1k
- #include <stdafx.h>
- #include "..//Drawer.h"
- #include "RTRenderer.h"
- class CDefaultTexture : public sgRayTracingTexture::sgCSolidTexture
- {
- public:
- float m_red;
- float m_green;
- float m_blue;
- float m_alpha;
- virtual void GetColor(sgRayTracingTexture::RT_COLOR& col) const
- {
- col.m_red = m_red;
- col.m_green = m_green;
- col.m_blue = m_blue;
- col.m_alpha = m_alpha;
- }
- };
- class CDefaultMaterial : public sgCMaterial
- {
- public:
- CDefaultTexture m_def_texture;
- virtual const sgRayTracingTexture::sgCTexture* GetTexture() const {return &m_def_texture;};
- };
- static CDefaultMaterial default_material;
- int MyRenderer::GetWidth()
- {
- return m_draw_sizes.cx;
- }
- int MyRenderer::GetHeight()
- {
- return m_draw_sizes.cy;
- }
- sgCMaterial* MyRenderer::GetMaterial(const sgCObject* ooo)
- {
- sgC3DObject* obj3D = (sgC3DObject*)(ooo);
- const float* obj_col = Drawer::GetColorByIndex(ooo->GetAttribute(SG_OA_COLOR));
- default_material.m_def_texture.m_red = obj_col[0];
- default_material.m_def_texture.m_green = obj_col[1];
- default_material.m_def_texture.m_blue = obj_col[2];
- default_material.m_def_texture.m_alpha = 0.0f;
- return &default_material;
- };