本文整理汇总了C++中ref_ptr::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ref_ptr::addChild方法的具体用法?C++ ref_ptr::addChild怎么用?C++ ref_ptr::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ref_ptr
的用法示例。
在下文中一共展示了ref_ptr::addChild方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_Model3D
void main_Model3D(ref_ptr<Group> pScene) {
ref_ptr<Model3D> pModel3D = new Model3D();
pModel3D->setColor(Vec4(0.0, 1.0, 0.0, 1.0));
pModel3D->setIsTargetPick(true);
pScene->addChild(pModel3D);
}
示例2: drawLine
void BezierCurveVisualizer::drawLine(ref_ptr<MatrixTransform> master, Vec3 point1, Vec3 point2, Vec4 color, float linewidth)
{
ref_ptr<Vec3Array> lineCoordList = new Vec3Array(2);
lineCoordList.get()->at(0) = point1;
lineCoordList.get()->at(1) = point2;
ref_ptr<Vec4Array> lineColorList = new Vec4Array;
lineColorList->push_back(color);
ref_ptr<Geometry> lineGeoset = new Geometry;
ref_ptr<StateSet> lineGeoset_state = lineGeoset->getOrCreateStateSet();
lineGeoset->setVertexArray(lineCoordList);
lineGeoset->setColorArray(lineColorList);
lineGeoset->setColorBinding(Geometry::BIND_OVERALL);
lineGeoset->addPrimitiveSet(new DrawArrays(PrimitiveSet::LINES, 0, 2));
ref_ptr<LineWidth> lw = new LineWidth(linewidth);
lineGeoset_state->setAttribute(lw);
ref_ptr<Material> mtl = new Material;
mtl->setColorMode(Material::AMBIENT_AND_DIFFUSE);
mtl->setAmbient(Material::FRONT_AND_BACK, Vec4(0.2f, 0.2f, 0.2f, 1.f));
mtl->setDiffuse(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setSpecular(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setEmission(Material::FRONT_AND_BACK, Vec4(0.0f, 0.0f, 0.0f, 1.f));
mtl->setShininess(Material::FRONT_AND_BACK, 16.f);
// lineGeoState->setAttributeAndModes(material, osg::StateAttribute::ON);
lineGeoset_state->setAttribute(mtl.get());
ref_ptr<Geode> lineGeode = new Geode;
lineGeode->addDrawable(lineGeoset);
master->addChild(lineGeode);
}
示例3: visualizeCasteljau
void BezierSurfaceVisualizer::visualizeCasteljau(ref_ptr<MatrixTransform> master)
{
std::vector<Vec3> preCasteljauPoints;
std::vector<Vec3> casteljauU;
Vec4 colors[9];
colors[0] = Vec4(0.0, 0.0, 0.5, 1.0); // steel blue
colors[1] = Vec4(0.0, 1.0, 0.0, 1.0); //green
colors[2] = Vec4(1.0, 0.39, 0.28, 1.0); //light red
colors[3] = Vec4(1.0, 1.0, 0.0, 1.0); //yellow
colors[4] = Vec4(1.0, 0.0, 1.0, 1.0); //purple
colors[5] = Vec4(0.0, 0.55, 0.0, 1.0); //dark green
colors[6] = Vec4(0.0, 0.75, 1.0, 1.0); //light blue
colors[7] = Vec4(0.6, 0.2, 0.8, 1.0); //dark orchid
colors[8] = Vec4(0.93, 0.71, 0.13, 1.0); //gold
int counter = 0;
for (size_t i = 0; i < controlPoints.size(); i++)
{
preCasteljauPoints.push_back(controlPoints[i]);
counter++;
if (counter == n)
{
counter = 0;
casteljauU.push_back(visualizeCasteljauCurve(master, preCasteljauPoints, parameterV));
preCasteljauPoints.clear();
}
}
int colorOffset = casteljauU.size() - 3 + (n - m);
for (size_t i = 0; i < casteljauU.size() - 1; i++)
{
drawLine(master, casteljauU[i], casteljauU[i + 1], colors[colorOffset]);
}
Vec3 casteljauPoint = visualizeCasteljauCurve(master, casteljauU, parameterU, colorOffset + 1);
osg::Sphere *unitSphere = new osg::Sphere(casteljauPoint, 10);
osg::ShapeDrawable *unitSphereDrawable = new osg::ShapeDrawable(unitSphere);
ref_ptr<StateSet> sphere_state = unitSphereDrawable->getOrCreateStateSet();
unitSphereDrawable->setColor(colors[casteljauU.size() - 3 + colorOffset + 1]);
ref_ptr<Material> mtl = new Material;
mtl->setColorMode(Material::AMBIENT_AND_DIFFUSE);
mtl->setAmbient(Material::FRONT_AND_BACK, Vec4(0.2f, 0.2f, 0.2f, 1.f));
mtl->setDiffuse(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setSpecular(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setEmission(Material::FRONT_AND_BACK, Vec4(0.0f, 0.0f, 0.0f, 1.f));
mtl->setShininess(Material::FRONT_AND_BACK, 16.f);
sphere_state->setAttribute(mtl.get());
ref_ptr<Geode> sphereGeode = new Geode;
sphereGeode->addDrawable(unitSphereDrawable);
master->addChild(sphereGeode.get());
}
示例4:
// associe un objet light a un objet lightsource
ref_ptr<LightSource> MyView::associeLightASource(ref_ptr<Light> light,ref_ptr<Camera> camera){
ref_ptr<LightSource> source = new LightSource;
source->setLight(light);
if(light->getLightNum() == 0){
source->setReferenceFrame(LightSource::ABSOLUTE_RF);
}
camera->addChild(source);
return source;
}
示例5: creerSwitchOnGeode
void MyView::creerSwitchOnGeode(ref_ptr<MatrixTransform> matrix,ref_ptr<Geode> geode,ref_ptr<Geode> geodeAlt){
ModeleVue* modelV = ModeleVue::getInstance();
ref_ptr<Switch> switchB = new Switch;
// ajout des deux matrix au switch
switchB->addChild(geode,true);
switchB->addChild(geodeAlt,false);
// ajout du switch a la camera
matrix->addChild(switchB);
}
示例6: creerSwitchOnMatrix
void MyView::creerSwitchOnMatrix(ref_ptr<Camera> camera,ref_ptr<MatrixTransform> mBouton,ref_ptr<MatrixTransform> mBoutonAlt){
ModeleVue* modelV = ModeleVue::getInstance();
ref_ptr<Switch> switchB = new Switch;
// ajout des deux matrix au switch
switchB->addChild(mBouton,true);
switchB->addChild(mBoutonAlt,false);
// ajout du switch a la camera
camera->addChild(switchB);
modelV->ajouterSwitch(switchB);
}
示例7: visualizeCasteljau
void BezierCurveVisualizer::visualizeCasteljau(ref_ptr<MatrixTransform> master, double t)
{
Vec4 colors[9];
colors[0] = Vec4(0.0, 1.0, 0.0, 1.0); //green
colors[1] = Vec4(0.93, 0.71, 0.13, 1.0); //gold
colors[2] = Vec4(0.0, 0.0, 0.5, 1.0); // steel blue
colors[3] = Vec4(0.6, 0.2, 0.8, 1.0); //dark orchid
colors[4] = Vec4(0.0, 0.75, 1.0, 1.0); //light blue
colors[5] = Vec4(1.0, 0.39, 0.28, 1.0); //light red
colors[6] = Vec4(0.0, 0.55, 0.0, 1.0); //dark green
colors[7] = Vec4(1.0, 1.0, 0.0, 1.0); //yellow
colors[8] = Vec4(1.0, 0.0, 1.0, 1.0); //purple
std::vector<Vec3> points = controlPoints;
int steps = points.size() - 1;
for (int n = 0; n < steps; n++)
{
for (int i = 0; i < int(points.size() - 1) - n; i++)
{
points[i] *= (1 - t);
Vec3 tmp = points[i + 1];
tmp *= t;
points[i] += tmp;
}
for (int j = 0; j < int(points.size()) - 2 - n; j++)
{
drawLine(master, points[j], points[j + 1], colors[n]);
}
}
ref_ptr<Vec4Array> lineColorList = new Vec4Array;
lineColorList->push_back(colors[2]);
osg::Sphere *unitSphere = new osg::Sphere(points[0], 0.3);
osg::ShapeDrawable *unitSphereDrawable = new osg::ShapeDrawable(unitSphere);
ref_ptr<StateSet> sphere_state = unitSphereDrawable->getOrCreateStateSet();
unitSphereDrawable->setColor(colors[controlPoints.size() - 3]);
ref_ptr<Material> mtl = new Material;
mtl->setColorMode(Material::AMBIENT_AND_DIFFUSE);
mtl->setAmbient(Material::FRONT_AND_BACK, Vec4(0.2f, 0.2f, 0.2f, 1.f));
mtl->setDiffuse(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setSpecular(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setEmission(Material::FRONT_AND_BACK, Vec4(0.0f, 0.0f, 0.0f, 1.f));
mtl->setShininess(Material::FRONT_AND_BACK, 16.f);
sphere_state->setAttribute(mtl.get());
ref_ptr<Geode> sphereGeode = new Geode;
sphereGeode->addDrawable(unitSphereDrawable);
master->addChild(sphereGeode.get());
}
示例8: visualizeCasteljauCurve
Vec3 BezierSurfaceVisualizer::visualizeCasteljauCurve(ref_ptr<MatrixTransform> master, std::vector<Vec3> casteljauPoints, double t, int colorOffset)
{
Vec4 colors[9];
colors[0] = Vec4(0.0, 0.0, 0.5, 1.0); // steel blue
colors[1] = Vec4(0.0, 1.0, 0.0, 1.0); //green
colors[2] = Vec4(1.0, 0.39, 0.28, 1.0); //light red
colors[3] = Vec4(1.0, 1.0, 0.0, 1.0); //yellow
colors[4] = Vec4(1.0, 0.0, 1.0, 1.0); //purple
colors[5] = Vec4(0.0, 0.55, 0.0, 1.0); //dark green
colors[6] = Vec4(0.0, 0.75, 1.0, 1.0); //light blue
colors[7] = Vec4(0.6, 0.2, 0.8, 1.0); //dark orchid
colors[8] = Vec4(0.93, 0.71, 0.13, 1.0); //gold
std::vector<Vec3> points = casteljauPoints;
int steps = points.size() - 1;
for (size_t n = 0; ssize_t(n) < steps; n++)
{
for (size_t i = 0; i < points.size() - 1 - n; i++)
{
points[i] *= (1 - t);
Vec3 tmp = points[i + 1];
tmp *= t;
points[i] += tmp;
}
for (size_t j = 0; j < points.size() - 2 - n; j++)
{
drawLine(master, points[j], points[j + 1], colors[n + colorOffset]);
}
}
osg::Sphere *unitSphere = new osg::Sphere(points[0], 7);
osg::ShapeDrawable *unitSphereDrawable = new osg::ShapeDrawable(unitSphere);
ref_ptr<StateSet> sphere_state = unitSphereDrawable->getOrCreateStateSet();
unitSphereDrawable->setColor(colors[casteljauPoints.size() - 3 + colorOffset]);
ref_ptr<Material> mtl = new Material;
mtl->setColorMode(Material::AMBIENT_AND_DIFFUSE);
mtl->setAmbient(Material::FRONT_AND_BACK, Vec4(0.2f, 0.2f, 0.2f, 1.f));
mtl->setDiffuse(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setSpecular(Material::FRONT_AND_BACK, Vec4(0.9f, 0.9f, 0.9f, 1.f));
mtl->setEmission(Material::FRONT_AND_BACK, Vec4(0.0f, 0.0f, 0.0f, 1.f));
mtl->setShininess(Material::FRONT_AND_BACK, 16.f);
sphere_state->setAttribute(mtl.get());
ref_ptr<Geode> sphereGeode = new Geode;
sphereGeode->addDrawable(unitSphereDrawable);
master->addChild(sphereGeode.get());
return points[0];
}
示例9:
BezierSurfaceVisualizer::BezierSurfaceVisualizer(ref_ptr<MatrixTransform> master)
{
bezierDCS = new MatrixTransform;
lineDCS = NULL;
showCasteljauGeom = false;
showSurfaceGeom = false;
showControlPolygonGeom = false;
n = 0;
m = 0;
parameterU = 0;
parameterV = 0;
master->addChild(bezierDCS.get());
}
示例10:
BezierCurveVisualizer::BezierCurveVisualizer(ref_ptr<MatrixTransform> master, Computation computation)
{
bezierDCS = new MatrixTransform;
lineDCS = NULL;
this->computation = computation;
showCasteljauGeom = false;
showCurveGeom = false;
showControlPolygonGeom = false;
showTangentBeginGeom = false;
showTangentEndGeom = false;
t = 0;
master->addChild(bezierDCS.get());
}
示例11: processInput
// Override
void processInput(
SceneParser *parser,
SceneInputNode &input,
const ref_ptr<StateNode> &parent)
{
ref_ptr<State> state = ref_ptr<State>::alloc();
ref_ptr<StateNode> newNode = ref_ptr<StateNode>::alloc(state);
newNode->set_name(input.getName());
newNode->set_isHidden(GL_TRUE);
parent->addChild(newNode);
parser->putNode(input.getName(), newNode);
handleChildren(parser,input,newNode);
ViewNode viewNode;
viewNode.name = input.getName();
viewNode.node = newNode;
viewNodes_->push_back(viewNode);
REGEN_INFO("View: " << viewNode.name);
}
示例12: drawPatch
void BezierSurfaceVisualizer::drawPatch(ref_ptr<MatrixTransform> master, Vec3 p1, Vec3 p2, Vec3 p3, Vec3 p4, Vec4 color)
{
ref_ptr<Vec3Array> patchCoordList = new Vec3Array(4);
patchCoordList.get()->at(0) = p1;
patchCoordList.get()->at(1) = p2;
patchCoordList.get()->at(2) = p3;
patchCoordList.get()->at(3) = p4;
ref_ptr<Geometry> patchGeoset = new Geometry;
patchGeoset->setVertexArray(patchCoordList);
patchGeoset->addPrimitiveSet(new DrawArrays(PrimitiveSet::POLYGON, 0, 4));
ref_ptr<Vec4Array> patchColorList = new Vec4Array(1);
patchColorList.get()->at(0) = color;
patchGeoset->setColorArray(patchColorList);
patchGeoset->setColorBinding(osg::Geometry::BIND_OVERALL);
ref_ptr<Vec3Array> normals = new osg::Vec3Array(1);
Vec3 normal = computeNormal(p1, p2, p3);
normals.get()->at(0) = normal;
patchGeoset->setNormalArray(normals);
patchGeoset->setNormalBinding(osg::Geometry::BIND_OVERALL);
ref_ptr<StateSet> patchGeoset_state = patchGeoset->getOrCreateStateSet();
ref_ptr<Material> mtl = new Material;
mtl->setColorMode(Material::AMBIENT_AND_DIFFUSE);
mtl->setAmbient(Material::FRONT_AND_BACK, Vec4(0.1f, 0.1f, 0.1f, 1.f));
mtl->setDiffuse(Material::FRONT_AND_BACK, Vec4(0.1f, 0.1f, 0.1f, 1.f));
mtl->setSpecular(Material::FRONT_AND_BACK, Vec4(0.0f, 0.0f, 0.0f, 1.f));
mtl->setEmission(Material::FRONT_AND_BACK, Vec4(0.0f, 0.0f, 0.0f, 1.f));
mtl->setShininess(Material::FRONT_AND_BACK, 0.1f);
patchGeoset_state->setAttribute(mtl.get());
patchGeoset_state->setMode(GL_LIGHTING, osg::StateAttribute::ON);
patchGeoset_state->setMode(GL_BLEND, osg::StateAttribute::ON);
patchGeoset_state->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
ref_ptr<Geode> patchGeode = new Geode;
patchGeode->addDrawable(patchGeoset);
master->addChild(patchGeode);
}
示例13: createObjetPersonnalise
//Méthode qui crée la ligne de séparation entre le rangement et les cases de jeu en définissant entièrement l'objet 3D
// Le deuxieme paramètre est pour définir la ligne du haut ou la ligne du bas
void MyView::createObjetPersonnalise(ref_ptr<Camera> camera, double yBoiteP){
ModeleVue* modelV = ModeleVue::getInstance();
ref_ptr<Vec3Array> vertexArray = new Vec3Array;
double tailleEcart = modelV->getTaille_ecart();
double tailleCase = modelV->getTaille_case();
double tailleCaseEcart = modelV->getTaille_case_ecart();
double tailleMur = modelV->getTaille_mur();
double taillePlateau = TAILLE_PLATEAU;
double xBoite = (taillePlateau/2.) - 2*tailleCaseEcart;
double yBoite = yBoiteP;
double zBoite = EPAISSEURCASE/2+EPAISSEUR_PLATEAU/2;
ref_ptr<Geometry> rectanglePerso = new Geometry;
//BIND_OVERALL sur la color car je ne peux pas de différenciation des couleurs par sommet
rectanglePerso->setColorBinding(Geometry::BIND_OVERALL);
rectanglePerso->setNormalBinding(Geometry::BIND_OVERALL);
ref_ptr<Vec4Array> colorArray = new Vec4Array;
colorArray->push_back(BEIGE);
rectanglePerso->setColorArray(colorArray);
//rectanglePerso->setNormalArray(normalArray);
//4 points formant la 'base' de la forme
vertexArray->push_back(Vec3(xBoite,yBoite,zBoite)); //down back right 0
vertexArray->push_back(Vec3(-xBoite,yBoite-tailleEcart,zBoite)); //down front left 1
vertexArray->push_back(Vec3(-xBoite,yBoite,zBoite)); //down back left 2
vertexArray->push_back(Vec3(xBoite,yBoite-tailleEcart,zBoite)); //down front right 3
//4 points formant le 'toit' de la forme
vertexArray->push_back(Vec3(xBoite,yBoite,zBoite+tailleEcart)); //top back right 4
vertexArray->push_back(Vec3(-xBoite,yBoite-tailleEcart,zBoite+tailleEcart)); //top front left 5
vertexArray->push_back(Vec3(-xBoite,yBoite,zBoite+tailleEcart)); //top back left 6
vertexArray->push_back(Vec3(xBoite,yBoite-tailleEcart,zBoite+tailleEcart)); //top front right 7
rectanglePerso->setVertexArray(vertexArray);
//ref_ptr<Vec3Array> normalArray = new Vec3Array;
//normalArray->push_back(Vec3(0,0,1));
// Explicite comment il faut utiliser les sommets pour créer la surface requise
// On respecte bien l'ordre anti-horlogique
// On crée chacunes des faces pour créer l'objet en 3D
ref_ptr<DrawElementsUInt> base = new DrawElementsUInt(GL_QUADS);
base->push_back(3);
base->push_back(0);
base->push_back(2);
base->push_back(1);
rectanglePerso->addPrimitiveSet(base);
ref_ptr<DrawElementsUInt> toit = new DrawElementsUInt(GL_QUADS);
toit->push_back(7);
toit->push_back(4);
toit->push_back(6);
toit->push_back(5);
rectanglePerso->addPrimitiveSet(toit);
ref_ptr<DrawElementsUInt> back = new DrawElementsUInt(GL_QUADS);
back->push_back(0);
back->push_back(4);
back->push_back(6);
back->push_back(2);
rectanglePerso->addPrimitiveSet(back);
ref_ptr<DrawElementsUInt> front = new DrawElementsUInt(GL_QUADS);
front->push_back(3);
front->push_back(7);
front->push_back(5);
front->push_back(1);
rectanglePerso->addPrimitiveSet(front);
ref_ptr<DrawElementsUInt> left = new DrawElementsUInt(GL_QUADS);
left->push_back(1);
left->push_back(5);
left->push_back(6);
left->push_back(2);
rectanglePerso->addPrimitiveSet(left);
ref_ptr<DrawElementsUInt> right = new DrawElementsUInt(GL_QUADS);
right->push_back(3);
right->push_back(7);
right->push_back(4);
right->push_back(0);
rectanglePerso->addPrimitiveSet(right);
//Instanciation de la Geometry
ref_ptr<Geode> unRectanglePerso = new Geode;
StateSet* stateset;
stateset = unRectanglePerso->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,StateAttribute::OFF);
unRectanglePerso->addDrawable(rectanglePerso.get());
// ne fait pas ce qu'on veut mais la couleur rend bien avec la texture dessus
ref_ptr<Texture2D> textureBois = creationTexture("woodtexture1.jpg");
unRectanglePerso->getOrCreateStateSet()->setTextureAttributeAndModes(0,textureBois.get());
camera->addChild(unRectanglePerso);
}
示例14: main
int main(int argc, char **argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// read the first useful arguments for creating video geode
int camNumber=0;
arguments.read("--cam",camNumber);
int imWidth = 640;
arguments.read("--width",imWidth);
int imHeight = 480;
arguments.read("--height",imHeight);
int threshold = 230;
arguments.read("--thres",threshold);
// do we want to use a movie?
movieName="";
arguments.read("--video", movieName);
if(!movieName.empty())
cout<<"Movie name: "<<movieName<<endl;
// we need the scene's state set to enable the light for the entire scene
scene = new Group();
lightStateSet = scene->getOrCreateStateSet();
lightStateSet->ref();
/*cout<<"Number of arguments: "<<arguments.argc()<<endl;
movieName = "";
if(arguments.argc() >= 3 && arguments.isString(2)){
movieName = arguments[2];
cout<<"Movie name: "<<movieName<<endl;
}*/
// create VideoGeometry
try {
videoGeode = new VideoGeode(movieName,camNumber,imWidth,imHeight);
videoGeode->setThreshold(threshold);
// stars / starfield
Material *material = new Material();
material->setEmission(Material::FRONT, Vec4(1.0f, 1.0f, 1.0f, 1.0f));
material->setAmbient(Material::FRONT, Vec4(1.0f, 1.0f, 1.0f, 1.0f));
material->setShininess(Material::FRONT, 25.0f);
// creating a video plane
videoGeode->prepareMaterial(material);
//videoPlane = videoGeode->createVideoPlane(1,1, true);
videoPlane = videoGeode->createVideoPlane(2,2, true);
videoPlane->setPosition(Vec3(0,0,0));
} catch (char *e) {
std::cerr << e;
}
scene->addChild(videoPlane);
// load the nodes from the commandline arguments.
model = new PositionAttitudeTransform();
Node *osgModel = osgDB::readNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!osgModel) osgModel = osgDB::readNodeFile("cessna.osg"); // I can't get Xcode to search in this directory (OSG_FILE_PATH) so this does not work
if (osgModel)
{
// Resizing the model so that it fits in the window
BoundingSphere bs = osgModel->getBound();
float bsR = bs.radius();
float targetSize = 1.0f; // we set up the projection matrix as an ortho 2d between -1 and 1 --> hence the radius of the model should be of size 1
float factor = targetSize / bsR;
std::cout << "Model Bounding Sphere radius is: " << bsR << std::endl;
std::cout << "Scale factor is: " << factor << std::endl;
model->setScale(osg::Vec3d(factor,factor,factor));
}
// Adding the model to the PAT node
model->addChild(osgModel);
//Group *scene = startup();
//if (!scene) return 1;
// create a light
lightSource = new LightSource();
lightSource->setLight(createLight(Vec4(0.9f, 0.9f, 0.9f, 1.0f)));
// enable the light for the entire scene
lightSource->setLocalStateSetModes(StateAttribute::ON);
lightSource->setStateSetModes(*lightStateSet, StateAttribute::ON);
lightTransform = new PositionAttitudeTransform();
lightTransform->addChild(lightSource);
lightTransform->setPosition(Vec3(0, 0, 100));
// Adding the 3D model to the scene
scene->addChild(lightTransform);
scene->addChild(model);
// Testing the movie
//osg::Image* image = osgDB::readImageFile(arguments[2]);
//cout<<"Number of arguments: "<<arguments.argc()<<endl;
//.........这里部分代码省略.........