mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0024310: TKOpenGl - GLSL compatibility issues
Lights defintion clean up: - remove duplicated enumeration TLightType (equals to Visual3d_TypeOfLightSource) - remove unused fields from Graphic3d_CLight - OpenGl_Light, reuse Graphic3d_CLight definition Phong GLSL program: - move out cumulative ambient light intencity from limited list of lights - compatibility issues, replace array of structures (light sources, materials, clipping planes) with arrays of primitive types New Draw Harness command vlight to alter light sources definition. OpenGl_ShaderProgram::Initialize() - add missing Linker log
This commit is contained in:
@@ -917,42 +917,24 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceLightSources (const GLdouble th
|
||||
{
|
||||
myRaytraceSceneData.LightSources.clear();
|
||||
|
||||
OpenGl_ListOfLight::Iterator anItl (myView->LightList());
|
||||
|
||||
OpenGl_RTVec4f aAmbient (0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
for (; anItl.More(); anItl.Next())
|
||||
OpenGl_RTVec4f anAmbient (0.0f, 0.0f, 0.0f, 0.0f);
|
||||
for (OpenGl_ListOfLight::Iterator anItl (myView->LightList());
|
||||
anItl.More(); anItl.Next())
|
||||
{
|
||||
const OpenGl_Light &aLight = anItl.Value();
|
||||
|
||||
if (aLight.type == TLightAmbient)
|
||||
const OpenGl_Light& aLight = anItl.Value();
|
||||
if (aLight.Type == Visual3d_TOLS_AMBIENT)
|
||||
{
|
||||
aAmbient += OpenGl_RTVec4f (aLight.col.rgb[0],
|
||||
aLight.col.rgb[1],
|
||||
aLight.col.rgb[2],
|
||||
0.f);
|
||||
anAmbient += OpenGl_RTVec4f (aLight.Color.r(), aLight.Color.g(), aLight.Color.b(), 0.0f);
|
||||
continue;
|
||||
}
|
||||
|
||||
OpenGl_RTVec4f aDiffuse (aLight.col.rgb[0],
|
||||
aLight.col.rgb[1],
|
||||
aLight.col.rgb[2],
|
||||
1.f);
|
||||
|
||||
OpenGl_RTVec4f aPosition (-aLight.dir[0],
|
||||
-aLight.dir[1],
|
||||
-aLight.dir[2],
|
||||
0.f);
|
||||
|
||||
if (aLight.type != TLightDirectional)
|
||||
OpenGl_RTVec4f aDiffuse (aLight.Color.r(), aLight.Color.g(), aLight.Color.b(), 1.0f);
|
||||
OpenGl_RTVec4f aPosition (-aLight.Direction.x(), -aLight.Direction.y(), -aLight.Direction.z(), 0.0f);
|
||||
if (aLight.Type != Visual3d_TOLS_DIRECTIONAL)
|
||||
{
|
||||
aPosition = OpenGl_RTVec4f (aLight.pos[0],
|
||||
aLight.pos[1],
|
||||
aLight.pos[2],
|
||||
1.f);
|
||||
aPosition = OpenGl_RTVec4f (aLight.Position.x(), aLight.Position.y(), aLight.Position.z(), 1.0f);
|
||||
}
|
||||
|
||||
if (aLight.HeadLight)
|
||||
if (aLight.IsHeadlight)
|
||||
{
|
||||
aPosition = MatVecMult (theInvModelView, aPosition);
|
||||
}
|
||||
@@ -962,11 +944,11 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceLightSources (const GLdouble th
|
||||
|
||||
if (myRaytraceSceneData.LightSources.size() > 0)
|
||||
{
|
||||
myRaytraceSceneData.LightSources.front().Ambient += aAmbient;
|
||||
myRaytraceSceneData.LightSources.front().Ambient += anAmbient;
|
||||
}
|
||||
else
|
||||
{
|
||||
myRaytraceSceneData.LightSources.push_back (OpenGl_RaytraceLight (OpenGl_RTVec4f (aAmbient.xyz(), -1.0f)));
|
||||
myRaytraceSceneData.LightSources.push_back (OpenGl_RaytraceLight (OpenGl_RTVec4f (anAmbient.rgb(), -1.0f)));
|
||||
}
|
||||
|
||||
cl_int anError = CL_SUCCESS;
|
||||
|
Reference in New Issue
Block a user