Lichter

3 Arten von Lichtern und wie sie in C++ verwendet werden

Punktlicht / Point Light / SoPointLight

SoPointLight *myPlight = new SoPointLight;
myPlight->color.setValue(1, 0, 0);
myPlight->intensity = 0.9;
myPlight->on = TRUE;
myPlight->location.setValue(0, 2.2, 0);     
root->addChild(myPlight);
or
SoPointLight *myPlight = new SoPointLight;
myPlight->set("color 1 0 0");
myPlight->set("intensity 0.9");
myPlight->set("on 1");
myPlight->set("location 0 2.2 0");
root->addChild(myPlight);

Gerichtetes Licht / Directional Light / SoDirectionalLight

SoDirectionalLight *myDlight = new SoDirectionalLight;
myDlight->color.setValue(0, 0.5, 0.9);
myDlight->intensity = 0.75;
myDlight->direction.setValue(0.3, 1, 0.3);     
root->addChild(myDlight);

Spotlicht / Spot light / SoSpotLight

SoSpotLight *mySlight = new SoSpotLight;
mySlight->color.setValue(0.1, 0.95, 0.1);
mySlight->intensity = 0.9;
mySlight->location.setValue(3, 5, 2.5);     
mySlight->direction.setValue(0, -1, 0);     
mySlight->dropOffRate = 0;     
mySlight->cutOffAngle = M_PI/3;     
root->addChild(mySlight);

Header-Files:
#include <Inventor/nodes/SoPointLight.h>
#include <Inventor/nodes/SoDirectionalLight.h>
#include <Inventor/nodes/SoSpotLight.h>


























































This website has been archived and is no longer maintained.