bool SkyLight::Create(Sys_GraphicsPtr pGraphics) { m_pMaterial = pGraphics->CreateMaterialFromFile("./assets/standard/material/dr_render_directional_light.fx"); VertexFormat vf; vf.AddElement(VertexElement(0, VertexElement::POSITION, G_FORMAT_R32G32B32_FLOAT)); m_pMaterial->SetVertexFormat(vf); if(m_pMaterial == MaterialPtr()) { return false; } return true; }
bool SpotLight::Create(Sys_GraphicsPtr pGraphics) { math::Vector3* pVerts = MeshUtil::CreateSpotLightCone(m_range, m_angle, 50, m_nVerts); m_pVB = pGraphics->CreateBuffer(BT_VERTEX_BUFFER, sizeof(math::Vector3) * m_nVerts, pVerts, true); mem_free(pVerts); if(m_pVB == GPUBufferPtr()) { return false; } m_pMaterial = pGraphics->CreateMaterialFromFile("./assets/standard/material/dr_render_spot_light.fx"); if(m_pMaterial == MaterialPtr()) { return false; } VertexFormat vf; vf.AddElement(VertexElement(0, VertexElement::POSITION, G_FORMAT_R32G32B32_FLOAT)); m_pMaterial->SetVertexFormat(vf); return true; }