V-ART
|
#include <xmlscene.h>
Public Member Functions | |
XmlScene () | |
~XmlScene () | |
bool | LoadFromFile (const std::string &fileName) |
Parses the xml file. If it doesn't have errors, load scene. More... | |
bool | LoadScene (const std::string &basePath) |
Load the scene based in xml archieve. More... | |
SceneNode * | LoadSceneNode (XERCES_CPP_NAMESPACE::DOMNode *sceneList, const std::string &basePath) |
Load the nodes (transformations, geometry, etc.) of the scene. More... | |
MeshObject * | LoadMeshFromFile (std::string filen, std::string type, std::string meshName) |
Load MeshObjects from file. More... | |
void | loadDofs (XERCES_CPP_NAMESPACE::DOMNode *node, std::list< Dof * > *dofs) |
Load the dofs of the joint. More... | |
Public Member Functions inherited from VART::Scene | |
Scene () | |
virtual | ~Scene () |
Destructor. More... | |
std::list< const Light * > | GetLights () |
std::list< Camera * > | GetCameras () |
Returns a list of cameras. More... | |
void | AddLight (Light *newLight) |
Adds a light to the list of lights. More... | |
void | AddLight (const Light &newLight) |
Adds a light to the list of lights. More... | |
void | AddCamera (Camera *newCamera) |
Add a camera to the list of cameras. More... | |
void | AddObject (SceneNode *newObjectPtr) |
Add a object to the scene. More... | |
void | Unreference (const SceneNode *sceneNodePtr) |
Removes an object from scene graph. More... | |
const Light * | GetLight (const std::string &lightName) |
Finds a light by its name. More... | |
const Camera * | GetCamera (const std::string &cameraName) |
Finds an camera by its description. More... | |
void | SetCamera (const std::string &cameraName) |
Sets the current camera by its description. More... | |
std::list< SceneNode * > | GetObjects () |
SceneNode * | GetObject (const std::string &objectName) const |
Searches an object by its description. More... | |
SceneNode * | GetObjectRec (const std::string &objectName) const |
Recursively searches an object by its description. More... | |
const Color & | GetBackgroundColor () |
Returns the background color. More... | |
void | SetBackgroundColor (Color color) |
Sets the background color. More... | |
virtual bool | DrawOGL (Camera *cameraPtr=NULL) const |
Sets projection and draws graphics objects using OpenGL commands. More... | |
bool | DrawLightsOGL () const |
Set lights using OpenGL commands. More... | |
Camera * | GetCurrentCamera () const |
Returns the current camera in the scene or NULL if no camera exists. More... | |
const Camera * | UseNextCamera () |
const Camera * | UsePreviousCamera () |
void | SetCamerasAspectRatio (const std::string &cameraDescription, float newAspectRatio) |
Set the aspect ratio of camera by its description. More... | |
void | SetAllCamerasAspectRatio (float newAspectRatio) |
Set the aspect ratio of all cameras. More... | |
void | ChangeAllCamerasViewVolume (float horScale, float verScale) |
Changes the view volume of all cameras. More... | |
bool | ComputeBoundingBox () |
Computes the axis aligned bounding box of all objects. More... | |
const BoundingBox & | GetBoundingBox () const |
Returns the scene bounding box. Attention: uses the ComputeBoundingBox method to refresh value of bounding box. More... | |
void | SetBBoxVisibility (bool value) |
Sets the bounding box visibility. More... | |
void | SetBoundingBox (double minX, double minY, double minZ, double maxX, double maxY, double maxZ) |
Sets the bounding box. More... | |
void | ToggleBBoxVisibility () |
Toggles the bounding box visibility. More... | |
size_t | GetNumLights () const |
Returns the number of light in the scene. More... | |
void | MakeCameraViewAll () |
Fits the whole scene to drawing region. More... | |
void | SetDescription (const std::string &newDescr) |
Sets the scene description. More... | |
const std::string & | GetDescription () |
Returns the scene description. More... | |
std::list< SceneNode * > | GetAllSceneJoints () |
Get all scenenodes of type 'joint' in the scene. More... | |
std::list< SceneNode * > | GetAllSceneTypeObject (SceneNode::TypeID type) |
Get all scenenodes of type 'type' in the scene. More... | |
void | Pick (int x, int y, std::list< GraphicObj * > *resultListPtr) |
Picks objects from viewport coordinates. More... | |
void | XmlPrintOn (std::ostream &os) const |
Outputs XML representation of the scene. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from VART::XmlBase | |
XmlBase () | |
Creates an unitialized object. More... | |
bool | ParseFile (const std::string &fileName) |
Checks if the file comforms to DTD. More... | |
void | Terminate () |
Terminates Xerces objects. More... | |
Static Protected Member Functions inherited from VART::XmlBase | |
static bool | GetAttributeValue (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *nodePtr, const char itemName[], float *valuePtr) |
Gets an item value for certain node. More... | |
static bool | GetAttributeValue (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *nodePtr, const char itemName[], std::string *valuePtr) |
Gets an item value for certain node. More... | |
static bool | GetAttributeValue (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *nodePtr, const char itemName[], bool *valuePtr) |
Gets an item value for certain node. More... | |
Protected Attributes inherited from VART::Scene | |
std::list< const Light * > | lights |
Separate lights (not treated as common objects) More... | |
std::list< Camera * > | cameras |
std::list< SceneNode * > | objects |
Color | background |
Protected Attributes inherited from VART::XmlBase | |
XERCES_CPP_NAMESPACE::XercesDOMParser * | parserPtr |
XERCES_CPP_NAMESPACE::DOMDocument * | documentPtr |
Definition at line 19 of file xmlscene.h.
VART::XmlScene::XmlScene | ( | ) |
Definition at line 23 of file xmlscene.cpp.
VART::XmlScene::~XmlScene | ( | ) |
Definition at line 887 of file xmlscene.cpp.
void VART::XmlScene::loadDofs | ( | XERCES_CPP_NAMESPACE::DOMNode * | node, |
std::list< Dof * > * | dofs | ||
) |
Load the dofs of the joint.
Definition at line 812 of file xmlscene.cpp.
References VART::MemoryObj::autoDelete, VART::XmlBase::TempCString::GetValue(), VART::Point4D::Normalize(), VART::Dof::Set(), VART::Dof::SetDescription(), VART::Dof::SetRest(), and VART::Point4D::SetXYZW().
bool VART::XmlScene::LoadFromFile | ( | const std::string & | fileName | ) |
Parses the xml file. If it doesn't have errors, load scene.
Definition at line 27 of file xmlscene.cpp.
References VART::File::GetPathFromString().
VART::MeshObject * VART::XmlScene::LoadMeshFromFile | ( | std::string | filen, |
std::string | type, | ||
std::string | meshName | ||
) |
Load MeshObjects from file.
Definition at line 95 of file xmlscene.cpp.
References VART::MemoryObj::autoDelete, VART::SceneNode::GetDescription(), and VART::MeshObject::ReadFromOBJ().
bool VART::XmlScene::LoadScene | ( | const std::string & | basePath | ) |
Load the scene based in xml archieve.
Definition at line 57 of file xmlscene.cpp.
VART::SceneNode * VART::XmlScene::LoadSceneNode | ( | XERCES_CPP_NAMESPACE::DOMNode * | sceneList, |
const std::string & | basePath | ||
) |
Load the nodes (transformations, geometry, etc.) of the scene.
used to traversal in map of node attributes
fixMe: this must be implemented
FixMe: The spotlight must have an attenuation attribute
FixMe: The pointlight must have an attenuation attribute
Color attributes
Create a Joint and its dependencies
Definition at line 160 of file xmlscene.cpp.
References VART::SceneNode::AddChild(), VART::PolyaxialJoint::AddDof(), VART::UniaxialJoint::AddDof(), VART::BiaxialJoint::AddDof(), VART::MemoryObj::autoDelete, VART::XmlBase::TempCString::GetValue(), VART::Transform::MakeIdentity(), VART::Transform::MakeXRotation(), VART::Transform::MakeYRotation(), VART::Transform::MakeZRotation(), VART::Light::SetAmbientIntensity(), VART::Light::SetColor(), VART::Transform::SetData(), VART::SceneNode::SetDescription(), VART::Cylinder::SetHeight(), VART::Light::SetIntensity(), VART::Light::SetLocation(), VART::Sphere::SetMaterial(), VART::Cylinder::SetMaterial(), VART::Sphere::SetRadius(), VART::Cylinder::SetRadius(), and VART::Light::Turn().