1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0032121: Draw Harness, ViewerTest - implement -reset option for vlight command

vlight command has been revised to provide more friendly syntax.
Command now accepts light index or name as first argument.
Added arguments -enable/-disable for managing enabled state.
Added argument -reset to reset light parameters to default values.

V3d_Viewer::SetDefaultLights() now sets names "headlight" and "ambient" to created lights.
Graphic3d_TypeOfLightSource enumeration values have been renamed to avoid shortcuts.
Draw::Atof(), applied corrections to avoid explicit new/delete calls.
This commit is contained in:
kgv
2021-07-09 23:22:29 +03:00
parent cb7f92396f
commit 06d40093b7
44 changed files with 916 additions and 925 deletions

View File

@@ -75,10 +75,10 @@ AIS_LightSource::AIS_LightSource (const Handle(Graphic3d_CLight)& theLight)
myOpposMarkerType (Aspect_TOM_O_POINT),
mySize (50),
myNbArrows (5),
myNbSplitsQuadric (theLight->Type() == Graphic3d_TOLS_AMBIENT ? 10 : 30),
myNbSplitsQuadric (theLight->Type() == Graphic3d_TypeOfLightSource_Ambient ? 10 : 30),
myNbSplitsArrow (20),
myIsZoomable (theLight->Type() == Graphic3d_TOLS_POSITIONAL
|| theLight->Type() == Graphic3d_TOLS_SPOT),
myIsZoomable (theLight->Type() == Graphic3d_TypeOfLightSource_Positional
|| theLight->Type() == Graphic3d_TypeOfLightSource_Spot),
myToDisplayName (true),
myToDisplayRange (true),
myToSwitchOnClick (true)
@@ -101,7 +101,7 @@ AIS_LightSource::AIS_LightSource (const Handle(Graphic3d_CLight)& theLight)
myDrawer->ArrowAspect()->Aspect()->SetMarkerType (Aspect_TOM_EMPTY);
myDrawer->ArrowAspect()->Aspect()->SetMarkerScale (2.0f);
myArrowLineAspectShadow = new Graphic3d_AspectLine3d (Quantity_NOC_BLACK, Aspect_TOL_SOLID,
theLight->Type() != Graphic3d_TOLS_AMBIENT ? 3.0f : 1.0f);
theLight->Type() != Graphic3d_TypeOfLightSource_Ambient ? 3.0f : 1.0f);
myDrawer->SetupOwnShadingAspect();
myDrawer->ShadingAspect()->SetColor (aColor);
@@ -155,7 +155,7 @@ void AIS_LightSource::updateLightAspects()
myDrawer->ArrowAspect() ->SetColor (aColor);
myDrawer->ArrowAspect()->Aspect()->ChangeFrontMaterial().SetColor (aColor);
if (myLightSource->Type() == Graphic3d_TOLS_DIRECTIONAL)
if (myLightSource->Type() == Graphic3d_TypeOfLightSource_Directional)
{
const Standard_Real anAngleTol = 2.0 * M_PI / 180.0;
Aspect_TypeOfMarker aDirMark = Aspect_TOM_EMPTY;
@@ -179,7 +179,7 @@ void AIS_LightSource::updateLightTransformPersistence()
Handle(Graphic3d_TransformPers) aTrsfPers = myTransformPersistence;
switch (myLightSource->Type())
{
case Graphic3d_TOLS_AMBIENT:
case Graphic3d_TypeOfLightSource_Ambient:
{
if (!myIsZoomable)
{
@@ -194,7 +194,7 @@ void AIS_LightSource::updateLightTransformPersistence()
}
break;
}
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Directional:
{
Graphic3d_TransModeFlags aMode = myLightSource->IsHeadlight() ? Graphic3d_TMF_2d : Graphic3d_TMF_TriedronPers;
if (myIsZoomable)
@@ -221,8 +221,8 @@ void AIS_LightSource::updateLightTransformPersistence()
}
break;
}
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Positional:
case Graphic3d_TypeOfLightSource_Spot:
{
Graphic3d_TransModeFlags aMode = myLightSource->IsHeadlight()
? Graphic3d_TMF_CameraPers
@@ -265,7 +265,7 @@ void AIS_LightSource::updateLightLocalTransformation()
myLocalTransformation.Nullify();
switch (myLightSource->Type())
{
case Graphic3d_TOLS_AMBIENT:
case Graphic3d_TypeOfLightSource_Ambient:
{
if (myIsZoomable)
{
@@ -275,7 +275,7 @@ void AIS_LightSource::updateLightLocalTransformation()
}
break;
}
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Directional:
{
const gp_Pnt aLightPos = (myIsZoomable && !myLightSource->IsHeadlight())
? myLightSource->DisplayPosition()
@@ -286,7 +286,7 @@ void AIS_LightSource::updateLightLocalTransformation()
myLocalTransformation = new TopLoc_Datum3D (aTrsf);
break;
}
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TypeOfLightSource_Positional:
{
if (myIsZoomable)
{
@@ -296,7 +296,7 @@ void AIS_LightSource::updateLightLocalTransformation()
}
break;
}
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Spot:
{
gp_Trsf aTrsf;
const gp_Ax2 anAx2 (myIsZoomable ? myLightSource->Position() : gp::Origin(), -myLightSource->Direction());
@@ -317,11 +317,11 @@ void AIS_LightSource::setLocalTransformation (const Handle(TopLoc_Datum3D)& theT
const gp_Trsf aTrsf = theTrsf->Transformation();
switch (myLightSource->Type())
{
case Graphic3d_TOLS_AMBIENT:
case Graphic3d_TypeOfLightSource_Ambient:
{
break;
}
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Directional:
{
gp_Dir aNewDir = (-gp::DZ()).Transformed (aTrsf);
myLightSource->SetDirection (aNewDir);
@@ -332,13 +332,13 @@ void AIS_LightSource::setLocalTransformation (const Handle(TopLoc_Datum3D)& theT
}
break;
}
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TypeOfLightSource_Positional:
{
gp_Pnt aNewPos = gp::Origin().Transformed (aTrsf);
myLightSource->SetPosition (aNewPos);
break;
}
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Spot:
{
gp_Pnt aNewPos = gp::Origin().Transformed (aTrsf);
myLightSource->SetPosition (aNewPos);
@@ -379,10 +379,10 @@ void AIS_LightSource::Compute (const Handle(PrsMgr_PresentationManager)& ,
switch (myLightSource->Type())
{
case Graphic3d_TOLS_AMBIENT: computeAmbient (thePrs, theMode); break;
case Graphic3d_TOLS_DIRECTIONAL: computeDirectional(thePrs, theMode); break;
case Graphic3d_TOLS_POSITIONAL: computePositional (thePrs, theMode); break;
case Graphic3d_TOLS_SPOT: computeSpot (thePrs, theMode); break;
case Graphic3d_TypeOfLightSource_Ambient: computeAmbient (thePrs, theMode); break;
case Graphic3d_TypeOfLightSource_Directional: computeDirectional(thePrs, theMode); break;
case Graphic3d_TypeOfLightSource_Positional: computePositional (thePrs, theMode); break;
case Graphic3d_TypeOfLightSource_Spot: computeSpot (thePrs, theMode); break;
}
if (myToDisplayName)

View File

@@ -25,6 +25,7 @@
#include <Draw_ProgressIndicator.hxx>
#include <Draw_SequenceOfDrawable3D.hxx>
#include <Message.hxx>
#include <NCollection_Array1.hxx>
#include <NCollection_Map.hxx>
#include <Standard_SStream.hxx>
#include <Standard_Stream.hxx>
@@ -873,128 +874,154 @@ static Standard_Boolean Alphabetic(char c)
static Standard_Real Parse(char*&);
static Standard_Real ParseValue(char*& name)
static Standard_Real ParseValue (char*& theName)
{
while (*name == ' ' || *name == '\t') name++;
while (*theName == ' ' || *theName == '\t') { ++theName; }
Standard_Real x = 0;
switch (*name) {
case '\0' :
break;
case '(' :
name++;
x = Parse(name);
if (*name != ')')
std::cout << "Mismatched parenthesis" << std::endl;
name++;
break;
case '+' :
name++;
x = ParseValue(name);
break;
case '-' :
name++;
x = - ParseValue(name);
break;
default :
switch (*theName)
{
case '\0':
{
break;
}
case '(':
{
++theName;
x = Parse (theName);
if (*theName != ')')
{
// process a string
char* p = name;
while (Numeric(*p)) p++;
// process scientific notation
if ((*p == 'e') || (*p == 'E')) {
if (Numeric(*(p+1)) || *(p+1) == '+' || *(p+1) == '-')
p+= 2;
}
while (Numeric(*p) || Alphabetic(*p)) p++;
char c = *p;
*p = '\0';
if (Numeric(*name)) // numeric literal
x = Atof(name);
else if (!Draw::Get((Standard_CString) name,x)) { // variable
// search for a function ...
*p = c;
// count arguments
Standard_Integer argc = 1;
char* q = p;
while ((*q == ' ') || (*q == '\t')) q++;
if (*q == '(') {
Standard_Integer pc = 1;
argc = 2;
q++;
while ((pc > 0) && *q) {
if (*q == '(') pc++;
if (*q == ')') pc--;
if ((pc == 1) && (*q == ',')) argc++;
q++;
}
if (pc > 0) {
std::cout << "Unclosed parenthesis"<< std::endl;
x = 0;
}
else {
// build function call
// replace , and first and last () by space
if (argc > 1) {
Standard_Integer i = 2;
while (*p != '(') p++;
*p = ' ';
p++;
pc = 1;
while (pc > 0) {
if (*p == '(') pc++;
if (*p == ')') pc--;
if ((pc == 1) && (*p == ',')) {
*p = ' ';
p++;
i++;
}
else
p++;
}
*(p-1) = '\0';
c = *p;
Draw_Interpretor& aCommands = Draw::GetInterpretor();
// call the function, save the current result
char* sv = 0;
if (*aCommands.Result()) {
sv = new char [strlen(aCommands.Result())];
strcpy(sv,aCommands.Result());
aCommands.Reset();
}
if (aCommands.Eval(name) != 0) {
std::cout << "Call of function " << name << " failed" << std::endl;
x = 0;
}
else
x = Atof(aCommands.Result());
aCommands.Reset();
if (sv) {
aCommands << sv;
delete [] sv;
}
}
}
}
else
Draw_ParseFailed = Standard_True;
}
*p = c;
name = p;
std::cout << "Mismatched parenthesis" << std::endl;
}
++theName;
break;
}
case '+':
{
++theName;
x = ParseValue (theName);
break;
}
case '-':
{
++theName;
x = - ParseValue (theName);
break;
}
default:
{
// process a string
char* p = theName;
while (Numeric (*p)) { ++p; }
// process scientific notation
if ((*p == 'e') || (*p == 'E'))
{
if (Numeric (*(p+1)) || *(p+1) == '+' || *(p+1) == '-')
{
p+= 2;
}
}
while (Numeric (*p) || Alphabetic (*p)) { p++; }
char c = *p;
*p = '\0';
if (Numeric (*theName)) // numeric literal
{
x = Atof (theName);
}
else if (!Draw::Get ((Standard_CString )theName, x)) // variable
{
// search for a function ...
*p = c;
// count arguments
Standard_Integer argc = 1;
char* q = p;
while ((*q == ' ') || (*q == '\t')) { ++q; }
if (*q == '(')
{
Standard_Integer pc = 1;
argc = 2;
q++;
while ((pc > 0) && *q)
{
if (*q == '(') { ++pc; }
if (*q == ')') { --pc; }
if ((pc == 1) && (*q == ',')) { ++argc; }
++q;
}
if (pc > 0)
{
std::cout << "Unclosed parenthesis"<< std::endl;
x = 0;
}
else
{
// build function call
// replace , and first and last () by space
if (argc > 1)
{
Standard_Integer i = 2;
while (*p != '(') { ++p; }
*p = ' ';
++p;
pc = 1;
while (pc > 0)
{
if (*p == '(') { ++pc; }
if (*p == ')') { --pc; }
if ((pc == 1) && (*p == ','))
{
*p = ' ';
++p;
++i;
}
else
{
++p;
}
}
*(p-1) = '\0';
c = *p;
Draw_Interpretor& aCommands = Draw::GetInterpretor();
// call the function, save the current result
TCollection_AsciiString sv (aCommands.Result());
if (*aCommands.Result())
{
aCommands.Reset();
}
if (aCommands.Eval (theName) != 0)
{
std::cout << "Call of function " << theName << " failed" << std::endl;
x = 0;
}
else
{
x = Atof (aCommands.Result());
}
aCommands.Reset();
if (!sv.IsEmpty())
{
aCommands << sv;
}
}
}
}
else
{
Draw_ParseFailed = Standard_True;
}
}
*p = c;
theName = p;
}
break;
}
while (*name == ' ' || *name == '\t') name++;
while (*theName == ' ' || *theName == '\t')
{
++theName;
}
return x;
}
@@ -1055,17 +1082,16 @@ static Standard_Real Parse(char*& name)
// function : Atof
// purpose :
//=======================================================================
Standard_Real Draw::Atof(const Standard_CString name)
Standard_Real Draw::Atof(const Standard_CString theName)
{
// copy the string
char* n = new char[1+strlen(name)];
char* b = n;
strcpy(n,name);
NCollection_Array1<char> aBuff (0, (Standard_Integer )strlen (theName));
char* n = &aBuff.ChangeFirst();
strcpy (n, theName);
Draw_ParseFailed = Standard_False;
Standard_Real x = Parse(n);
while ((*n == ' ') || (*n == '\t')) n++;
if (*n) Draw_ParseFailed = Standard_True;
delete [] b;
return x;
}

View File

@@ -33,10 +33,10 @@ void Graphic3d_CLight::makeId()
TCollection_AsciiString aTypeSuffix;
switch (myType)
{
case Graphic3d_TOLS_AMBIENT: aTypeSuffix = "amb"; break;
case Graphic3d_TOLS_DIRECTIONAL: aTypeSuffix = "dir"; break;
case Graphic3d_TOLS_POSITIONAL: aTypeSuffix = "pos"; break;
case Graphic3d_TOLS_SPOT: aTypeSuffix = "spot"; break;
case Graphic3d_TypeOfLightSource_Ambient: aTypeSuffix = "amb"; break;
case Graphic3d_TypeOfLightSource_Directional: aTypeSuffix = "dir"; break;
case Graphic3d_TypeOfLightSource_Positional: aTypeSuffix = "pos"; break;
case Graphic3d_TypeOfLightSource_Spot: aTypeSuffix = "spot"; break;
}
myId = TCollection_AsciiString ("Graphic3d_CLight_") + aTypeSuffix
@@ -62,23 +62,23 @@ Graphic3d_CLight::Graphic3d_CLight (Graphic3d_TypeOfLightSource theType)
{
switch (theType)
{
case Graphic3d_TOLS_AMBIENT:
case Graphic3d_TypeOfLightSource_Ambient:
{
break;
}
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Directional:
{
mySmoothness = 0.2f;
myIntensity = 20.0f;
break;
}
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TypeOfLightSource_Positional:
{
changeConstAttenuation() = 1.0f;
changeLinearAttenuation() = 0.0f;
break;
}
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Spot:
{
changeConstAttenuation() = 1.0f;
changeLinearAttenuation() = 0.0f;
@@ -90,6 +90,39 @@ Graphic3d_CLight::Graphic3d_CLight (Graphic3d_TypeOfLightSource theType)
makeId();
}
// =======================================================================
// function : CopyFrom
// purpose :
// =======================================================================
void Graphic3d_CLight::CopyFrom (const Handle(Graphic3d_CLight)& theLight)
{
myName = theLight->myName;
myIsEnabled = theLight->myIsEnabled;
myIntensity = theLight->myIntensity;
myColor = theLight->myColor;
if (myType != Graphic3d_TypeOfLightSource_Ambient)
{
myPosition = theLight->myPosition;
myIsHeadlight = theLight->myIsHeadlight;
}
if ((myType == Graphic3d_TypeOfLightSource_Spot
|| myType == Graphic3d_TypeOfLightSource_Directional)
&& (theLight->myType == Graphic3d_TypeOfLightSource_Spot
|| theLight->myType == Graphic3d_TypeOfLightSource_Directional))
{
myDirection = theLight->myDirection;
}
if (myType == Graphic3d_TypeOfLightSource_Directional)
{
myToCastShadows = theLight->myToCastShadows;
}
if (myType == theLight->myType)
{
myParams = theLight->myParams;
mySmoothness = theLight->mySmoothness;
}
}
// =======================================================================
// function : SetColor
// purpose :
@@ -116,7 +149,7 @@ void Graphic3d_CLight::SetEnabled (Standard_Boolean theIsOn)
// =======================================================================
void Graphic3d_CLight::SetCastShadows (Standard_Boolean theToCast)
{
if (myType != Graphic3d_TOLS_DIRECTIONAL)
if (myType != Graphic3d_TypeOfLightSource_Directional)
{
throw Standard_NotImplemented ("Graphic3d_CLight::SetCastShadows() is not implemented for this light type");
}
@@ -130,7 +163,7 @@ void Graphic3d_CLight::SetCastShadows (Standard_Boolean theToCast)
// =======================================================================
void Graphic3d_CLight::SetHeadlight (Standard_Boolean theValue)
{
if (myType == Graphic3d_TOLS_AMBIENT)
if (myType == Graphic3d_TypeOfLightSource_Ambient)
{
throw Standard_ProgramError ("Graphic3d_CLight::SetHeadlight() is not applicable to ambient light");
}
@@ -144,8 +177,8 @@ void Graphic3d_CLight::SetHeadlight (Standard_Boolean theValue)
// =======================================================================
void Graphic3d_CLight::SetDirection (const gp_Dir& theDir)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_SPOT
&& myType != Graphic3d_TOLS_DIRECTIONAL,
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Spot
&& myType != Graphic3d_TypeOfLightSource_Directional,
"Graphic3d_CLight::SetDirection(), incorrect light type");
updateRevisionIf (Abs (myDirection.x() - static_cast<Standard_ShortReal> (theDir.X())) > ShortRealEpsilon()
|| Abs (myDirection.y() - static_cast<Standard_ShortReal> (theDir.Y())) > ShortRealEpsilon()
@@ -162,8 +195,8 @@ void Graphic3d_CLight::SetDirection (const gp_Dir& theDir)
// =======================================================================
void Graphic3d_CLight::SetPosition (const gp_Pnt& thePosition)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_SPOT
&& myType != Graphic3d_TOLS_POSITIONAL,
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Spot
&& myType != Graphic3d_TypeOfLightSource_Positional,
"Graphic3d_CLight::SetPosition(), incorrect light type");
updateRevisionIf (!myPosition.IsEqual (thePosition, gp::Resolution()));
myPosition = thePosition;
@@ -175,7 +208,7 @@ void Graphic3d_CLight::SetPosition (const gp_Pnt& thePosition)
// =======================================================================
void Graphic3d_CLight::SetDisplayPosition (const gp_Pnt& thePosition)
{
Standard_ProgramError_Raise_if (myType == Graphic3d_TOLS_AMBIENT,
Standard_ProgramError_Raise_if (myType == Graphic3d_TypeOfLightSource_Ambient,
"Graphic3d_CLight::SetDisplayPosition(), incorrect light type");
updateRevisionIf (!myPosition.IsEqual (thePosition, gp::Resolution()));
myPosition = thePosition;
@@ -198,7 +231,7 @@ void Graphic3d_CLight::SetIntensity (Standard_ShortReal theValue)
// =======================================================================
void Graphic3d_CLight::SetAngle (Standard_ShortReal theAngle)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_SPOT,
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Spot,
"Graphic3d_CLight::SetAngle(), incorrect light type");
Standard_OutOfRange_Raise_if (theAngle <= 0.0 || theAngle >= M_PI,
"Graphic3d_CLight::SetAngle(), bad angle");
@@ -213,8 +246,8 @@ void Graphic3d_CLight::SetAngle (Standard_ShortReal theAngle)
void Graphic3d_CLight::SetAttenuation (Standard_ShortReal theConstAttenuation,
Standard_ShortReal theLinearAttenuation)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_POSITIONAL
&& myType != Graphic3d_TOLS_SPOT,
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Positional
&& myType != Graphic3d_TypeOfLightSource_Spot,
"Graphic3d_CLight::SetAttenuation(), incorrect light type");
Standard_OutOfRange_Raise_if (theConstAttenuation < 0.0f
|| theLinearAttenuation < 0.0f
@@ -231,7 +264,7 @@ void Graphic3d_CLight::SetAttenuation (Standard_ShortReal theConstAttenuation,
// =======================================================================
void Graphic3d_CLight::SetConcentration (Standard_ShortReal theConcentration)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_SPOT, "Graphic3d_CLight::SetConcentration(), incorrect light type");
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Spot, "Graphic3d_CLight::SetConcentration(), incorrect light type");
Standard_OutOfRange_Raise_if (theConcentration < 0.0f || theConcentration > 1.0f,
"Graphic3d_CLight::SetConcentration(), bad coefficient");
updateRevisionIf (Abs (changeConcentration() - theConcentration) > ShortRealEpsilon());
@@ -244,8 +277,8 @@ void Graphic3d_CLight::SetConcentration (Standard_ShortReal theConcentration)
// =======================================================================
void Graphic3d_CLight::SetSmoothRadius (Standard_ShortReal theValue)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_POSITIONAL
&& myType != Graphic3d_TOLS_SPOT,
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Positional
&& myType != Graphic3d_TypeOfLightSource_Spot,
"Graphic3d_CLight::SetSmoothRadius(), incorrect light type");
Standard_OutOfRange_Raise_if (theValue < 0.0f, "Graphic3d_CLight::SetSmoothRadius(), Bad value for smoothing radius");
updateRevisionIf (Abs (mySmoothness - theValue) > ShortRealEpsilon());
@@ -258,7 +291,7 @@ void Graphic3d_CLight::SetSmoothRadius (Standard_ShortReal theValue)
// =======================================================================
void Graphic3d_CLight::SetSmoothAngle (Standard_ShortReal theValue)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_DIRECTIONAL,
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Directional,
"Graphic3d_CLight::SetSmoothAngle(), incorrect light type");
Standard_OutOfRange_Raise_if (theValue < 0.0f || theValue > Standard_ShortReal(M_PI / 2.0),
"Graphic3d_CLight::SetSmoothAngle(), Bad value for smoothing angle");
@@ -272,7 +305,8 @@ void Graphic3d_CLight::SetSmoothAngle (Standard_ShortReal theValue)
// =======================================================================
void Graphic3d_CLight::SetRange (Standard_ShortReal theValue)
{
Standard_ProgramError_Raise_if (myType != Graphic3d_TOLS_POSITIONAL && myType != Graphic3d_TOLS_SPOT,
Standard_ProgramError_Raise_if (myType != Graphic3d_TypeOfLightSource_Positional
&& myType != Graphic3d_TypeOfLightSource_Spot,
"Graphic3d_CLight::SetRange(), incorrect light type");
Standard_OutOfRange_Raise_if (theValue < 0.0, "Graphic3d_CLight::SetRange(), Bad value for falloff range");
updateRevisionIf (Abs (Range() - theValue) > ShortRealEpsilon());
@@ -291,29 +325,29 @@ void Graphic3d_CLight::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myId)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName)
if (myType == Graphic3d_TOLS_SPOT || myType == Graphic3d_TOLS_POSITIONAL)
if (myType == Graphic3d_TypeOfLightSource_Spot || myType == Graphic3d_TypeOfLightSource_Positional)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPosition)
}
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColor)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIntensity)
if (myType == Graphic3d_TOLS_SPOT || myType == Graphic3d_TOLS_DIRECTIONAL)
if (myType == Graphic3d_TypeOfLightSource_Spot || myType == Graphic3d_TypeOfLightSource_Directional)
{
gp_Dir aDirection = Direction();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aDirection)
}
if (myType == Graphic3d_TOLS_POSITIONAL || myType == Graphic3d_TOLS_SPOT)
if (myType == Graphic3d_TypeOfLightSource_Positional || myType == Graphic3d_TypeOfLightSource_Spot)
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ConstAttenuation())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, LinearAttenuation())
}
if (myType == Graphic3d_TOLS_SPOT)
if (myType == Graphic3d_TypeOfLightSource_Spot)
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Angle())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Concentration())
}
if (myType == Graphic3d_TOLS_POSITIONAL || myType == Graphic3d_TOLS_SPOT)
if (myType == Graphic3d_TypeOfLightSource_Positional || myType == Graphic3d_TypeOfLightSource_Spot)
{
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Range())
}

View File

@@ -33,6 +33,9 @@ public:
//! Empty constructor, which should be followed by light source properties configuration.
Standard_EXPORT Graphic3d_CLight (Graphic3d_TypeOfLightSource theType);
//! Copy parameters from another light source excluding source type.
Standard_EXPORT void CopyFrom (const Handle(Graphic3d_CLight)& theLight);
//! Returns the Type of the Light, cannot be changed after object construction.
Graphic3d_TypeOfLightSource Type() const { return myType; }

View File

@@ -22,10 +22,10 @@ namespace
//! Suffixes identifying light source type.
static const char THE_LIGHT_KEY_LETTERS[Graphic3d_TypeOfLightSource_NB] =
{
'a', // Graphic3d_TOLS_AMBIENT
'd', // Graphic3d_TOLS_DIRECTIONAL
'p', // Graphic3d_TOLS_POSITIONAL
's' // Graphic3d_TOLS_SPOT
'a', // Graphic3d_TypeOfLightSource_Ambient
'd', // Graphic3d_TypeOfLightSource_Directional
'p', // Graphic3d_TypeOfLightSource_Positional
's' // Graphic3d_TypeOfLightSource_Spot
};
}
@@ -126,7 +126,7 @@ Standard_Size Graphic3d_LightSet::UpdateRevision()
}
myLightTypesEnabled[aLight->Type()] += 1;
if (aLight->Type() == Graphic3d_TOLS_AMBIENT)
if (aLight->Type() == Graphic3d_TypeOfLightSource_Ambient)
{
myAmbient += aLight->PackedColor() * aLight->Intensity();
}
@@ -145,12 +145,12 @@ Standard_Size Graphic3d_LightSet::UpdateRevision()
}
aKeyLong[aLightLast] = '\0';
myAmbient.a() = 1.0f;
myNbEnabled = myLightTypesEnabled[Graphic3d_TOLS_DIRECTIONAL]
+ myLightTypesEnabled[Graphic3d_TOLS_POSITIONAL]
+ myLightTypesEnabled[Graphic3d_TOLS_SPOT];
myNbEnabled = myLightTypesEnabled[Graphic3d_TypeOfLightSource_Directional]
+ myLightTypesEnabled[Graphic3d_TypeOfLightSource_Positional]
+ myLightTypesEnabled[Graphic3d_TypeOfLightSource_Spot];
myKeyEnabledLong = aKeyLong;
myKeyEnabledShort = TCollection_AsciiString (myLightTypesEnabled[Graphic3d_TOLS_DIRECTIONAL] > 0 ? THE_LIGHT_KEY_LETTERS[Graphic3d_TOLS_DIRECTIONAL] : '\0')
+ TCollection_AsciiString (myLightTypesEnabled[Graphic3d_TOLS_POSITIONAL] > 0 ? THE_LIGHT_KEY_LETTERS[Graphic3d_TOLS_POSITIONAL] : '\0')
+ TCollection_AsciiString (myLightTypesEnabled[Graphic3d_TOLS_SPOT] > 0 ? THE_LIGHT_KEY_LETTERS[Graphic3d_TOLS_SPOT] : '\0');
myKeyEnabledShort = TCollection_AsciiString (myLightTypesEnabled[Graphic3d_TypeOfLightSource_Directional] > 0 ? THE_LIGHT_KEY_LETTERS[Graphic3d_TypeOfLightSource_Directional] : '\0')
+ TCollection_AsciiString (myLightTypesEnabled[Graphic3d_TypeOfLightSource_Positional] > 0 ? THE_LIGHT_KEY_LETTERS[Graphic3d_TypeOfLightSource_Positional] : '\0')
+ TCollection_AsciiString (myLightTypesEnabled[Graphic3d_TypeOfLightSource_Spot] > 0 ? THE_LIGHT_KEY_LETTERS[Graphic3d_TypeOfLightSource_Spot] : '\0');
return myRevision;
}

View File

@@ -88,7 +88,7 @@ public:
for (; myIter.More(); myIter.Next())
{
if ((myFilter & IterationFilter_ExcludeAmbient) != 0
&& myIter.Key()->Type() == Graphic3d_TOLS_AMBIENT)
&& myIter.Key()->Type() == Graphic3d_TypeOfLightSource_Ambient)
{
continue;
}

View File

@@ -1168,7 +1168,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
for (Graphic3d_LightSet::Iterator aLightIter (theLights, Graphic3d_LightSet::IterationFilter_ExcludeDisabledAndAmbient);
aLightIter.More(); aLightIter.Next())
{
if (aLightIter.Value()->Type() == Graphic3d_TOLS_DIRECTIONAL
if (aLightIter.Value()->Type() == Graphic3d_TypeOfLightSource_Directional
&& aLightIter.Value()->ToCastShadows())
{
aLightsLoop = aLightsLoop + EOL" occDirectionalLight (" + anIndex + ", theNormal, theView, theIsFront,"
@@ -1182,11 +1182,11 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
{
switch (aLightIter.Value()->Type())
{
case Graphic3d_TOLS_AMBIENT:
case Graphic3d_TypeOfLightSource_Ambient:
{
break; // skip ambient
}
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Directional:
{
if (theNbShadowMaps > 0
&& aLightIter.Value()->ToCastShadows())
@@ -1197,13 +1197,13 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
++anIndex;
break;
}
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TypeOfLightSource_Positional:
{
aLightsLoop = aLightsLoop + EOL" occPointLight (" + anIndex + ", theNormal, theView, aPoint, theIsFront);";
++anIndex;
break;
}
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Spot:
{
aLightsLoop = aLightsLoop + EOL" occSpotLight (" + anIndex + ", theNormal, theView, aPoint, theIsFront);";
++anIndex;
@@ -1220,7 +1220,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
EOL" for (int anIndex = 0; anIndex < occLightSourcesCount; ++anIndex)"
EOL" {"
EOL" int aType = occLight_Type (anIndex);";
if (theLights->NbEnabledLightsOfType (Graphic3d_TOLS_DIRECTIONAL) > 0)
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Directional) > 0)
{
isFirstInLoop = false;
aLightsLoop +=
@@ -1229,7 +1229,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
EOL" occDirectionalLight (anIndex, theNormal, theView, theIsFront, 1.0);"
EOL" }";
}
if (theLights->NbEnabledLightsOfType (Graphic3d_TOLS_POSITIONAL) > 0)
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Positional) > 0)
{
if (!isFirstInLoop)
{
@@ -1242,7 +1242,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
EOL" occPointLight (anIndex, theNormal, theView, aPoint, theIsFront);"
EOL" }";
}
if (theLights->NbEnabledLightsOfType (Graphic3d_TOLS_SPOT) > 0)
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Spot) > 0)
{
if (!isFirstInLoop)
{
@@ -1267,7 +1267,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
aLightsFunc += Shaders_PBRIllumination_glsl;
}
if (theLights->NbEnabledLightsOfType (Graphic3d_TOLS_DIRECTIONAL) == 1
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Directional) == 1
&& theNbLights == 1
&& !theIsPBR
&& theNbShadowMaps == 0)
@@ -1276,7 +1276,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
aLightsLoop = EOL" directionalLightFirst(theNormal, theView, theIsFront, 1.0);";
aLightsFunc += THE_FUNC_directionalLightFirst;
}
else if (theLights->NbEnabledLightsOfType (Graphic3d_TOLS_DIRECTIONAL) > 0)
else if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Directional) > 0)
{
if (theNbShadowMaps > 0)
{
@@ -1284,11 +1284,11 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
}
aLightsFunc += theIsPBR ? Shaders_PBRDirectionalLight_glsl : Shaders_PhongDirectionalLight_glsl;
}
if (theLights->NbEnabledLightsOfType (Graphic3d_TOLS_POSITIONAL) > 0)
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Positional) > 0)
{
aLightsFunc += theIsPBR ? Shaders_PBRPointLight_glsl : Shaders_PhongPointLight_glsl;
}
if (theLights->NbEnabledLightsOfType (Graphic3d_TOLS_SPOT) > 0)
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Spot) > 0)
{
aLightsFunc += theIsPBR ? Shaders_PBRSpotLight_glsl : Shaders_PhongSpotLight_glsl;
}

View File

@@ -20,21 +20,27 @@
//! Definition of all the type of light source.
enum Graphic3d_TypeOfLightSource
{
Graphic3d_TOLS_AMBIENT, //!< ambient light
Graphic3d_TOLS_DIRECTIONAL, //!< directional light
Graphic3d_TOLS_POSITIONAL, //!< positional light
Graphic3d_TOLS_SPOT, //!< spot light
Graphic3d_TypeOfLightSource_Ambient, //!< ambient light
Graphic3d_TypeOfLightSource_Directional, //!< directional light
Graphic3d_TypeOfLightSource_Positional, //!< positional light
Graphic3d_TypeOfLightSource_Spot, //!< spot light
// obsolete aliases
V3d_AMBIENT = Graphic3d_TOLS_AMBIENT,
V3d_DIRECTIONAL = Graphic3d_TOLS_DIRECTIONAL,
V3d_POSITIONAL = Graphic3d_TOLS_POSITIONAL,
V3d_SPOT = Graphic3d_TOLS_SPOT
Graphic3d_TOLS_AMBIENT = Graphic3d_TypeOfLightSource_Ambient,
Graphic3d_TOLS_DIRECTIONAL = Graphic3d_TypeOfLightSource_Directional,
Graphic3d_TOLS_POSITIONAL = Graphic3d_TypeOfLightSource_Positional,
Graphic3d_TOLS_SPOT = Graphic3d_TypeOfLightSource_Spot,
//
V3d_AMBIENT = Graphic3d_TypeOfLightSource_Ambient,
V3d_DIRECTIONAL = Graphic3d_TypeOfLightSource_Directional,
V3d_POSITIONAL = Graphic3d_TypeOfLightSource_Positional,
V3d_SPOT = Graphic3d_TypeOfLightSource_Spot
};
enum
{
//! Auxiliary value defining the overall number of values in enumeration Graphic3d_TypeOfLightSource
Graphic3d_TypeOfLightSource_NB = Graphic3d_TOLS_SPOT + 1
Graphic3d_TypeOfLightSource_NB = Graphic3d_TypeOfLightSource_Spot + 1
};
#endif // _Graphic3d_TypeOfLightSource_HeaderFile

View File

@@ -54,8 +54,11 @@ namespace
const Graphic3d_Vec4& aLightColor = theLight.PackedColor();
switch (theLight.Type())
{
case Graphic3d_TOLS_AMBIENT : break; // handled by separate if-clause at beginning of method
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Ambient:
{
break; // handled by separate if-clause at beginning of method
}
case Graphic3d_TypeOfLightSource_Directional:
{
// if the last parameter of GL_POSITION, is zero, the corresponding light source is a Directional one
const OpenGl_Vec4 anInfDir = -theLight.PackedDirectionRange();
@@ -70,7 +73,7 @@ namespace
theCtx->core11ffp->glLightf (theLightGlId, GL_SPOT_CUTOFF, THE_DEFAULT_SPOT_CUTOFF);
break;
}
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TypeOfLightSource_Positional:
{
// to create a realistic effect, set the GL_SPECULAR parameter to the same value as the GL_DIFFUSE
const OpenGl_Vec4 aPosition (static_cast<float>(theLight.Position().X()), static_cast<float>(theLight.Position().Y()), static_cast<float>(theLight.Position().Z()), 1.0f);
@@ -86,7 +89,7 @@ namespace
theCtx->core11ffp->glLightf (theLightGlId, GL_QUADRATIC_ATTENUATION, 0.0f);
break;
}
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Spot:
{
const OpenGl_Vec4 aPosition (static_cast<float>(theLight.Position().X()), static_cast<float>(theLight.Position().Y()), static_cast<float>(theLight.Position().Z()), 1.0f);
theCtx->core11ffp->glLightfv (theLightGlId, GL_AMBIENT, THE_DEFAULT_AMBIENT);
@@ -464,7 +467,7 @@ void OpenGl_ShaderManager::pushLightSourceState (const Handle(OpenGl_ShaderProgr
if (!aLight.IsEnabled()) // has no affect with Graphic3d_LightSet::IterationFilter_ExcludeDisabled - here just for consistency
{
// if it is desired to keep disabled light in the same order - we can replace it with a black light so that it will have no influence on result
aLightType = -1; // Graphic3d_TOLS_AMBIENT can be used instead
aLightType = -1; // Graphic3d_TypeOfLightSource_Ambient can be used instead
aLightParams.Color = OpenGl_Vec4 (0.0f, 0.0f, 0.0f, 0.0f);
++aLightsNb;
continue;
@@ -478,11 +481,11 @@ void OpenGl_ShaderManager::pushLightSourceState (const Handle(OpenGl_ShaderProgr
aLightParams.Parameters = aLight.PackedParams();
switch (aLight.Type())
{
case Graphic3d_TOLS_AMBIENT:
case Graphic3d_TypeOfLightSource_Ambient:
{
break;
}
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Directional:
{
if (aLight.IsHeadlight())
{
@@ -496,7 +499,7 @@ void OpenGl_ShaderManager::pushLightSourceState (const Handle(OpenGl_ShaderProgr
}
break;
}
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Spot:
{
if (aLight.IsHeadlight())
{
@@ -510,7 +513,7 @@ void OpenGl_ShaderManager::pushLightSourceState (const Handle(OpenGl_ShaderProgr
}
}
Standard_FALLTHROUGH
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TypeOfLightSource_Positional:
{
if (aLight.IsHeadlight())
{

View File

@@ -93,11 +93,11 @@ bool OpenGl_ShadowMap::UpdateCamera (const Graphic3d_CView& theView,
switch (myShadowLight->Type())
{
case Graphic3d_TOLS_AMBIENT:
case Graphic3d_TypeOfLightSource_Ambient:
{
return false; // not applicable
}
case Graphic3d_TOLS_DIRECTIONAL:
case Graphic3d_TypeOfLightSource_Directional:
{
if (theOrigin != NULL)
{
@@ -134,12 +134,12 @@ bool OpenGl_ShadowMap::UpdateCamera (const Graphic3d_CView& theView,
myLightMatrix = myShadowCamera->ProjectionMatrixF() * myShadowCamera->OrientationMatrixF();
return true;
}
case Graphic3d_TOLS_POSITIONAL:
case Graphic3d_TypeOfLightSource_Positional:
{
// render into cubemap shadowmap texture
return false; // not implemented
}
case Graphic3d_TOLS_SPOT:
case Graphic3d_TypeOfLightSource_Spot:
{
//myShadowCamera->SetProjectionType (Graphic3d_Camera::Projection_Perspective);
//myShadowCamera->SetEye (theCastShadowLight->Position());

View File

@@ -154,7 +154,7 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
myWorkspace = new OpenGl_Workspace (this, NULL);
Handle(Graphic3d_CLight) aLight = new Graphic3d_CLight (Graphic3d_TOLS_AMBIENT);
Handle(Graphic3d_CLight) aLight = new Graphic3d_CLight (Graphic3d_TypeOfLightSource_Ambient);
aLight->SetColor (Quantity_NOC_WHITE);
myLights = new Graphic3d_LightSet();
myNoShadingLight = new Graphic3d_LightSet();

View File

@@ -2440,7 +2440,7 @@ Standard_Boolean OpenGl_View::updateRaytraceLightSources (const OpenGl_Mat4& the
aLightIter.More(); aLightIter.Next())
{
const Graphic3d_CLight& aLight = *aLightIter.Value();
if (aLight.Type() != Graphic3d_TOLS_DIRECTIONAL)
if (aLight.Type() != Graphic3d_TypeOfLightSource_Directional)
{
aLightSources.push_back (aLightIter.Value());
}
@@ -2449,7 +2449,7 @@ Standard_Boolean OpenGl_View::updateRaytraceLightSources (const OpenGl_Mat4& the
for (Graphic3d_LightSet::Iterator aLightIter (myLights, Graphic3d_LightSet::IterationFilter_ExcludeDisabledAndAmbient);
aLightIter.More(); aLightIter.Next())
{
if (aLightIter.Value()->Type() == Graphic3d_TOLS_DIRECTIONAL)
if (aLightIter.Value()->Type() == Graphic3d_TypeOfLightSource_Directional)
{
aLightSources.push_back (aLightIter.Value());
}
@@ -2484,7 +2484,7 @@ Standard_Boolean OpenGl_View::updateRaytraceLightSources (const OpenGl_Mat4& the
-aLight.PackedDirectionRange().z(),
0.0f);
if (aLight.Type() != Graphic3d_TOLS_DIRECTIONAL)
if (aLight.Type() != Graphic3d_TypeOfLightSource_Directional)
{
aPosition = BVH_Vec4f (static_cast<float>(aLight.Position().X()),
static_cast<float>(aLight.Position().Y()),

View File

@@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_AmbientLight, Graphic3d_CLight)
// purpose :
// =======================================================================
V3d_AmbientLight::V3d_AmbientLight (const Quantity_Color& theColor)
: Graphic3d_CLight (Graphic3d_TOLS_AMBIENT)
: Graphic3d_CLight (Graphic3d_TypeOfLightSource_Ambient)
{
SetColor (theColor);
}

View File

@@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight)
V3d_DirectionalLight::V3d_DirectionalLight (const V3d_TypeOfOrientation theDirection,
const Quantity_Color& theColor,
const Standard_Boolean theIsHeadlight)
: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL)
: V3d_PositionLight (Graphic3d_TypeOfLightSource_Directional)
{
SetColor (theColor);
SetHeadlight (theIsHeadlight);
@@ -38,7 +38,7 @@ V3d_DirectionalLight::V3d_DirectionalLight (const V3d_TypeOfOrientation theDirec
V3d_DirectionalLight::V3d_DirectionalLight (const gp_Dir& theDirection,
const Quantity_Color& theColor,
const Standard_Boolean theIsHeadlight)
: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL)
: V3d_PositionLight (Graphic3d_TypeOfLightSource_Directional)
{
SetColor (theColor);
SetHeadlight (theIsHeadlight);

View File

@@ -21,7 +21,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_PositionalLight,V3d_PositionLight)
// =======================================================================
V3d_PositionalLight::V3d_PositionalLight (const gp_Pnt& thePos,
const Quantity_Color& theColor)
: V3d_PositionLight (Graphic3d_TOLS_POSITIONAL)
: V3d_PositionLight (Graphic3d_TypeOfLightSource_Positional)
{
SetColor (theColor);
SetPosition (thePos);

View File

@@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_SpotLight,V3d_PositionLight)
V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
const V3d_TypeOfOrientation theDirection,
const Quantity_Color& theColor)
: V3d_PositionLight (Graphic3d_TOLS_SPOT)
: V3d_PositionLight (Graphic3d_TypeOfLightSource_Spot)
{
SetColor (theColor);
SetPosition (thePos);
@@ -38,7 +38,7 @@ V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
const gp_Dir& theDirection,
const Quantity_Color& theColor)
: V3d_PositionLight (Graphic3d_TOLS_SPOT)
: V3d_PositionLight (Graphic3d_TypeOfLightSource_Spot)
{
SetColor (theColor);
SetPosition (thePos);

View File

@@ -439,8 +439,11 @@ void V3d_Viewer::SetDefaultLights()
DelLight (aLight);
}
Handle(V3d_DirectionalLight) aDirLight = new V3d_DirectionalLight (V3d_Zneg, Quantity_NOC_WHITE, Standard_True);
Handle(V3d_AmbientLight) anAmbLight = new V3d_AmbientLight (Quantity_NOC_WHITE);
Handle(V3d_DirectionalLight) aDirLight = new V3d_DirectionalLight (V3d_Zneg, Quantity_NOC_WHITE);
aDirLight->SetName ("headlight");
aDirLight->SetHeadlight (true);
Handle(V3d_AmbientLight) anAmbLight = new V3d_AmbientLight (Quantity_NOC_WHITE);
anAmbLight->SetName ("amblight");
AddLight (aDirLight);
AddLight (anAmbLight);
SetLightOn (aDirLight);

File diff suppressed because it is too large Load Diff