00001 #include <gra/scene/Scene.h>
00002 #include <esg/Group.h>
00003 #include <esg/explorer/NExtentsExplorer.h>
00004
00005 using namespace gra;
00006
00007 SceneGraphObject::OID Scene::appendModel(Parser& parser, const Matrix4* m)
00008 {
00009
00010 parser.setOID(_lastOID);
00011
00012
00013 while (parser.parseObject()) {
00014 SceneGraphObject * pObj = parser.getObject();
00015 if (pObj) _sceneGraph.append(pObj);
00016 }
00017
00018 LightSource * pLight = parser.getLight();
00019 while (pLight) {
00020 _haveLight = true;
00021 _sceneGraph.append(pLight);
00022 pLight = parser.getLight();
00023 }
00024
00025 _lastOID = parser.getOID();
00026
00027 if (m) _sceneGraph.setPrivateTransformation(new Transform(*m));
00028
00029 return _lastOID;
00030 }
00031
00032 SceneGraphObject::OID Scene::appendObject(SceneGraphObject* pObj)
00033 {
00034 if (pObj) {
00035 pObj->setOID(_lastOID++);
00036 _sceneGraph.append(pObj);
00037 }
00038
00039 #if 0
00040 if (!_sceneGraph.transformation()) {
00041 Transform * pTr = new Transform();
00042 pTr->scale(0.5, 2.0, 1.0);
00043 pTr->rotateX(PI/4);
00044 pTr->rotateY(PI/4);
00045 pTr->translate(1, 1, 0);
00046 _sceneGraph.setPrivateTransformation(pTr);
00047 }
00048 #endif
00049
00050 return _lastOID;
00051 }
00052
00053 SceneGraphObject::OID Scene::appendLight(LightSource* pLight)
00054 {
00055 if (pLight) {
00056 pLight->setOID(_lastOID++);
00057 _sceneGraph.append(pLight);
00058 _haveLight = true;
00059 }
00060 return _lastOID;
00061 }
00062
00063 void Scene::__debug()
00064 {
00065 _sceneGraph.__debug();
00066 }
00067
00068
00069