# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

# vl::DaeLoader Class Reference

COLLADA loader. More...

`#include <DaeLoader.hpp>`

List of all members.

## Public Member Functions

| DaeLoader ()
bool | load (VirtualFile *file)
const ResourceDatabase * | resources () const
ResourceDatabase * | resources ()
void | setLoadOptions (const LoadWriterDae::LoadOptions *options)
const LoadWriterDae::LoadOptions * | loadOptions () const

## Protected Member Functions

void | reset ()
void | parseInputs (Dae::Primitive *dae_primitive, const domInputLocalOffset_Array &input_arr, const std::vector< ref< Dae::Input > > &vertex_inputs)
ref< Dae::Mesh > | parseGeometry (daeElement *geometry)
Dae::Source * | getSource (daeElement *source_el)
void | bindMaterials (Dae::Node *dae_node, Dae::Mesh *dae_mesh, domBind_materialRef bind_material)
void | parseNode (daeElement *el, Dae::Node *parent)
void | parseAsset (domElement *root)
void | loadImages (const domImage_Array &images)
void | parseImages (daeElement *library)
void | parseEffects (daeElement *library)
void | prepareTexture2D (Dae::Sampler2D *sampler2D)
void | parseMaterials (daeElement *library)
ref< Light > | parseLight (domLight *, Transform *)
void | setupLights ()
ref< Effect > | setup_vl_Effect (Dae::Material *mat)
template<class T_color_or_texture >
void | parseColor (const domProfile_COMMON *common, const T_color_or_texture &color_or_texture, Dae::ColorOrTexture *out_col)
void | generateGeometry (Dae::Primitive *primitive, const char *name)

## Static Protected Member Functions

static std::string | percentDecode (const char *uri)
static Dae::EInputSemantic | getSemantic (const char *semantic)
static const char * | getSemanticString (Dae::EInputSemantic semantic)
static ETexParamFilter | translateSampleFilter (domFx_sampler_filter_common filter)
static ETexParamWrap | translateWrapMode (domFx_sampler_wrap_common wrap)

## Protected Attributes

const LoadWriterDae::LoadOptions * | mLoadOptions
ref< ResourceDatabase > | mResources
std::vector< ref< Light > > | mLights
std::map< daeElementRef, ref < Dae::Material > > | mMaterials
std::map< daeElementRef, ref < Dae::Effect > > | mEffects
std::map< daeElementRef, ref < Dae::Mesh > > | mMeshes
std::vector< ref< Dae::Node > > | mNodes
std::map< daeElementRef, ref < Dae::Source > > | mSources
std::map< daeElementRef, ref < Image > > | mImages
std::map< daeElementRef, ref < Dae::NewParam > > | mDaeNewParams
ref< Effect > | mDefaultFX
ref< Dae::Node > | mScene
DAE | mDAE
String | mFilePath
mat4 | mUpMatrix
bool | mInvertTransparency
bool | mAssumeOpaque

## Detailed Description

COLLADA loader.

Definition at line 41 of file DaeLoader.hpp.

## Constructor & Destructor Documentation

DaeLoader::DaeLoader | ( | ) |

Definition at line 77 of file DaeLoader.cpp.

References vl::EN_LIGHTING, mDefaultFX, vl::PM_LINE, and reset().

## Member Function Documentation

bool DaeLoader::load | ( | VirtualFile * | file ) |

Definition at line 726 of file DaeLoader.cpp.

References vl::Object::as(), vl::Matrix4< T_Scalar >::as3x3(), vl::LoadWriterDae::LoadOptions::computeMissingNormals(), vl::Geometry::computeNormals(), vl::Geometry::drawCalls(), vl::Actor::effect(), vl::EN_LIGHTING, vl::EN_NORMALIZE, vl::Shader::enable(), vl::Collection< T >::erase(), vl::Log::error(), vl::ref< T >::get(), vl::Shader::getEnableSet(), vl::Shader::getRenderStateSet(), vl::Matrix4< T_Scalar >::getX(), vl::Matrix4< T_Scalar >::getY(), vl::Matrix4< T_Scalar >::getZ(), vl::Matrix4< T_Scalar >::invert(), vl::Shader::isEnabled(), vl::Vector3< T_Scalar >::length(), vl::VirtualFile::load(), loadOptions(), vl::Actor::lod(), mDAE, vl::Geometry::mergeDrawCallsWithTriangles(), vl::Geometry::mergeTriangleStrips(), mFilePath, mLights, mNodes, mResources, mScene, mUpMatrix, vl::Geometry::normalArray(), vl::Object::objectName(), parseAsset(), parseEffects(), parseImages(), parseMaterials(), parseNode(), vl::VirtualFile::path(), vl::PT_UNKNOWN, vl::Collection< T >::push_back(), vl::Transform::removeFromParent(), reset(), vl::Actor::setEffect(), setupLights(), vl::Effect::shader(), vl::String::toStdString(), vl::Actor::transform(), vl::Matrix4< T_Scalar >::transpose(), and vl::Transform::worldMatrix().

Referenced by vl::LoadWriterDae::load().

const ResourceDatabase* vl::DaeLoader::resources | ( | ) | const`[inline]`

Definition at line 48 of file DaeLoader.hpp.

References vl::ref< T >::get(), and mResources.

Referenced by vl::LoadWriterDae::load().

ResourceDatabase* vl::DaeLoader::resources | ( | ) | `[inline]`

Definition at line 50 of file DaeLoader.hpp.

References vl::ref< T >::get(), and mResources.

void vl::DaeLoader::setLoadOptions | ( | const LoadWriterDae::LoadOptions * | options ) | `[inline]`

Definition at line 54 of file DaeLoader.hpp.

References mLoadOptions.

Referenced by vl::LoadWriterDae::load().

const LoadWriterDae::LoadOptions* vl::DaeLoader::loadOptions | ( | ) | const`[inline]`

Definition at line 56 of file DaeLoader.hpp.

References mLoadOptions.

Referenced by generateGeometry(), load(), parseAsset(), parseNode(), prepareTexture2D(), and setupLights().

void DaeLoader::reset | ( | ) | `[protected]`

Definition at line 91 of file DaeLoader.cpp.

References mAssumeOpaque, mInvertTransparency, mResources, mScene, and NULL.

Referenced by DaeLoader(), and load().

void DaeLoader::parseInputs | ( | Dae::Primitive * | dae_primitive,
|  | const domInputLocalOffset_Array & | input_arr,
|  | const std::vector< ref< Dae::Input > > & | vertex_inputs
| ) |  | `[protected]`

Definition at line 99 of file DaeLoader.cpp.

References getSemantic(), getSource(), vl::Dae::IS_UNKNOWN, vl::Dae::IS_VERTEX, vl::max(), vl::Dae::Primitive::mChannels, vl::Dae::Primitive::mIndexStride, and VL_CHECK.

Referenced by parseGeometry().

ref< Dae::Mesh > DaeLoader::parseGeometry | ( | daeElement * | geometry ) | `[protected]`

Definition at line 149 of file DaeLoader.cpp.

References vl::Log::error(), generateGeometry(), vl::ref< T >::get(), getSemantic(), getSource(), vl::Dae::IS_UNKNOWN, mDAE, mMeshes, NULL, parseInputs(), vl::PT_LINE_STRIP, vl::PT_LINES, vl::Dae::PT_POLYGONS, vl::PT_TRIANGLES, vl::Dae::PT_TRIFANS, vl::Dae::PT_TRISTRIPS, and VL_CHECK.

Referenced by parseNode().

Dae::Source * DaeLoader::getSource | ( | daeElement * | source_el ) | `[protected]`

Definition at line 385 of file DaeLoader.cpp.

References vl::Log::error(), vl::ref< T >::get(), mSources, NULL, and VL_CHECK.

Referenced by parseGeometry(), and parseInputs().

void DaeLoader::bindMaterials | ( | Dae::Node * | dae_node,
|  | Dae::Mesh * | dae_mesh,
|  | domBind_materialRef | bind_material
| ) |  | `[protected]`

Definition at line 527 of file DaeLoader.cpp.

References vl::ref< T >::get(), vl::Dae::Node::mActors, mDefaultFX, mMaterials, vl::Dae::Mesh::mPrimitives, vl::Dae::Node::mTransform, setup_vl_Effect(), VL_CHECK, and VL_LOG_DEBUG.

Referenced by parseNode().

void DaeLoader::parseNode | ( | daeElement * | el,
|  | Dae::Node * | parent
| ) |  | `[protected]`

Definition at line 590 of file DaeLoader.cpp.

References bindMaterials(), vl::Log::error(), vl::LoadWriterDae::LoadOptions::extractSkins(), vl::ref< T >::get(), vl::Matrix4< float >::getLookAt(), vl::Matrix4< float >::getRotation(), vl::Matrix4< float >::getScaling(), vl::Matrix4< float >::getTranslation(), loadOptions(), vl::Dae::Node::mChildren, mLights, mNodes, vl::Dae::Node::mTransform, parseGeometry(), parseLight(), vl::Matrix4< T_Scalar >::ptr(), vl::Matrix4< T_Scalar >::transpose(), and VL_CHECK.

Referenced by load().

void DaeLoader::parseAsset | ( | domElement * | root ) | `[protected]`

Definition at line 1872 of file DaeLoader.cpp.

References loadOptions(), mAssumeOpaque, mInvertTransparency, mUpMatrix, vl::Matrix4< T_Scalar >::setX(), vl::Matrix4< T_Scalar >::setY(), vl::Matrix4< T_Scalar >::setZ(), vl::LoadWriterDae::LoadOptions::TransparencyAuto, vl::LoadWriterDae::LoadOptions::TransparencyInvert, and VL_LOG_DEBUG.

Referenced by load().

void DaeLoader::loadImages | ( | const domImage_Array & | images ) | `[protected]`

Definition at line 910 of file DaeLoader.cpp.

References vl::Log::error(), vl::loadImage(), mImages, and percentDecode().

Referenced by parseEffects(), and parseImages().

void DaeLoader::parseImages | ( | daeElement * | library ) | `[protected]`

Definition at line 927 of file DaeLoader.cpp.

References loadImages().

Referenced by load().

void DaeLoader::parseEffects | ( | daeElement * | library ) | `[protected]`

Definition at line 936 of file DaeLoader.cpp.

References vl::Log::error(), vl::ref< T >::get(), loadImages(), mAssumeOpaque, mDaeNewParams, mEffects, mImages, mInvertTransparency, vl::Dae::OM_A_ONE, vl::Dae::OM_RGB_ZERO, parseColor(), prepareTexture2D(), translateSampleFilter(), translateWrapMode(), and VL_LOG_DEBUG.

Referenced by load().

void DaeLoader::prepareTexture2D | ( | Dae::Sampler2D * | sampler2D ) | `[protected]`

Definition at line 1267 of file DaeLoader.cpp.

References vl::ref< T >::get(), loadOptions(), vl::Dae::Sampler2D::mDaeSurface, vl::Dae::Sampler2D::mMagFilter, vl::Dae::Sampler2D::mMinFilter, vl::Dae::Sampler2D::mTexture, vl::Dae::Sampler2D::mWrapS, vl::Dae::Sampler2D::mWrapT, vl::TF_UNKNOWN, vl::TPF_LINEAR, vl::TPF_LINEAR_MIPMAP_NEAREST, and vl::TPF_NEAREST.

Referenced by parseColor(), and parseEffects().

void DaeLoader::parseMaterials | ( | daeElement * | library ) | `[protected]`

Definition at line 1293 of file DaeLoader.cpp.

References mEffects, mMaterials, and VL_LOG_DEBUG.

Referenced by load().

ref< Light > DaeLoader::parseLight | ( | domLight * | dom_light,
|  | Transform * | transform
| ) |  | `[protected]`

Definition at line 1324 of file DaeLoader.cpp.

Referenced by parseNode().

void DaeLoader::setupLights | ( | ) | `[protected]`

Definition at line 1430 of file DaeLoader.cpp.

References vl::EN_DEPTH_TEST, vl::ref< T >::get(), vl::Matrix4< float >::getRotation(), vl::Matrix4< float >::getTranslation(), loadOptions(), vl::makeCone(), vl::makePyramid(), vl::makeTorus(), vl::makeUVSphere(), mLights, mResources, NULL, and vl::PM_LINE.

Referenced by load().

ref< Effect > DaeLoader::setup_vl_Effect | ( | Dae::Material * | mat ) | `[protected]`

Definition at line 431 of file DaeLoader.cpp.

References vl::Vector4< T_Scalar >::a(), vl::clamp(), vl::dot(), vl::EN_BLEND, vl::EN_CULL_FACE, vl::EN_DEPTH_TEST, vl::EN_LIGHTING, vl::Log::error(), vl::ref< T >::get(), vl::Dae::TechniqueCOMMON::mAmbient, mAssumeOpaque, vl::Dae::ColorOrTexture::mColor, vl::Dae::Material::mDaeEffect, vl::Dae::TechniqueCOMMON::mDiffuse, vl::Dae::TechniqueCOMMON::mEmission, vl::Dae::TechniqueCOMMON::mOpaqueMode, vl::Dae::ColorOrTexture::mSampler, vl::Dae::TechniqueCOMMON::mShininess, vl::Dae::TechniqueCOMMON::mSpecular, vl::Dae::TechniqueCOMMON::mTransparency, vl::Dae::TechniqueCOMMON::mTransparent, vl::Dae::OM_A_ONE, vl::Vector4< T_Scalar >::rgb(), and VL_CHECK.

Referenced by bindMaterials().

std::string DaeLoader::percentDecode | ( | const char * | uri ) | `[static, protected]`

Definition at line 859 of file DaeLoader.cpp.

Referenced by loadImages().

Dae::EInputSemantic DaeLoader::getSemantic | ( | const char * | semantic ) | `[static, protected]`

Definition at line 1526 of file DaeLoader.cpp.

References vl::Dae::IS_UNKNOWN.

Referenced by parseGeometry(), and parseInputs().

const char * DaeLoader::getSemanticString | ( | Dae::EInputSemantic | semantic ) | `[static, protected]`

Definition at line 1537 of file DaeLoader.cpp.

References NULL.

Referenced by generateGeometry().

ETexParamFilter DaeLoader::translateSampleFilter | ( | domFx_sampler_filter_common | filter ) | `[static, protected]`

Definition at line 1548 of file DaeLoader.cpp.

References vl::TPF_LINEAR, vl::TPF_LINEAR_MIPMAP_LINEAR, vl::TPF_LINEAR_MIPMAP_NEAREST, vl::TPF_NEAREST, vl::TPF_NEAREST_MIPMAP_LINEAR, and vl::TPF_NEAREST_MIPMAP_NEAREST.

Referenced by parseEffects().

ETexParamWrap DaeLoader::translateWrapMode | ( | domFx_sampler_wrap_common | wrap ) | `[static, protected]`

Definition at line 1562 of file DaeLoader.cpp.

References vl::TPW_CLAMP, vl::TPW_CLAMP_TO_BORDER, vl::TPW_MIRRORED_REPEAT, and vl::TPW_REPEAT.

Referenced by parseEffects().

template<class T_color_or_texture >

void DaeLoader::parseColor | ( | const domProfile_COMMON * | common,
|  | const T_color_or_texture & | color_or_texture,
|  | Dae::ColorOrTexture * | out_col
| ) |  | `[protected]`

Definition at line 1575 of file DaeLoader.cpp.

References vl::ref< T >::get(), vl::Dae::ColorOrTexture::mColor, mDaeNewParams, mImages, vl::Dae::ColorOrTexture::mSampler, vl::Dae::ColorOrTexture::mTexCoord, NULL, prepareTexture2D(), VL_CHECK, and VL_LOG_DEBUG.

Referenced by parseEffects().

void DaeLoader::generateGeometry | ( | Dae::Primitive * | primitive,
|  | const char * | name
| ) |  | `[protected]`

Definition at line 1626 of file DaeLoader.cpp.

References vl::dot(), vl::LoadWriterDae::LoadOptions::fixBadNormals(), vl::ref< T >::get(), getSemanticString(), vl::Dae::IS_COLOR, vl::Dae::IS_NORMAL, vl::Dae::IS_POSITION, vl::Dae::IS_TEXCOORD, loadOptions(), vl::Dae::Vert::mAttribIndex, vl::Dae::Primitive::mChannels, mDAE, vl::Dae::Primitive::mGeometry, vl::Dae::Vert::mIndex, vl::Dae::Primitive::mIndexStride, vl::Dae::Primitive::mP, vl::Dae::Primitive::mType, NULL, vl::PT_LINE_STRIP, vl::Dae::PT_LINE_STRIP, vl::PT_LINES, vl::Dae::PT_LINES, vl::PT_POINTS, vl::PT_POLYGON, vl::Dae::PT_POLYGONS, vl::PT_TRIANGLE_FAN, vl::PT_TRIANGLE_STRIP, vl::PT_TRIANGLES, vl::Dae::PT_TRIANGLES, vl::Dae::PT_TRIFANS, vl::Dae::PT_TRISTRIPS, vl::Dae::PT_UNKNOWN, vl::String::toStdString(), VL_CHECK, VL_LOG_DEBUG, VL_TRAP, and vl::Log::warning().

Referenced by parseGeometry().

## Member Data Documentation

const LoadWriterDae::LoadOptions* vl::DaeLoader::mLoadOptions`[protected]`

Definition at line 108 of file DaeLoader.hpp.

Referenced by loadOptions(), and setLoadOptions().

ref<ResourceDatabase> vl::DaeLoader::mResources`[protected]`

Definition at line 111 of file DaeLoader.hpp.

Referenced by load(), reset(), resources(), and setupLights().

std::vector< ref<Light> > vl::DaeLoader::mLights`[protected]`

Definition at line 112 of file DaeLoader.hpp.

Referenced by load(), parseNode(), and setupLights().

std::map< daeElementRef, ref<Dae::Material> > vl::DaeLoader::mMaterials`[protected]`

Definition at line 113 of file DaeLoader.hpp.

Referenced by bindMaterials(), and parseMaterials().

std::map< daeElementRef, ref<Dae::Effect> > vl::DaeLoader::mEffects`[protected]`

Definition at line 114 of file DaeLoader.hpp.

Referenced by parseEffects(), and parseMaterials().

std::map< daeElementRef, ref<Dae::Mesh> > vl::DaeLoader::mMeshes`[protected]`

Definition at line 115 of file DaeLoader.hpp.

Referenced by parseGeometry().

std::vector< ref<Dae::Node> > vl::DaeLoader::mNodes`[protected]`

Definition at line 116 of file DaeLoader.hpp.

Referenced by load(), and parseNode().

std::map< daeElementRef, ref<Dae::Source> > vl::DaeLoader::mSources`[protected]`

Definition at line 117 of file DaeLoader.hpp.

Referenced by getSource().

std::map< daeElementRef, ref<Image> > vl::DaeLoader::mImages`[protected]`

Definition at line 118 of file DaeLoader.hpp.

Referenced by loadImages(), parseColor(), and parseEffects().

std::map< daeElementRef, ref<Dae::NewParam> > vl::DaeLoader::mDaeNewParams`[protected]`

Definition at line 119 of file DaeLoader.hpp.

Referenced by parseColor(), and parseEffects().

ref<Effect> vl::DaeLoader::mDefaultFX`[protected]`

Definition at line 120 of file DaeLoader.hpp.

Referenced by bindMaterials(), and DaeLoader().

ref<Dae::Node> vl::DaeLoader::mScene`[protected]`

Definition at line 121 of file DaeLoader.hpp.

Referenced by load(), and reset().

DAE vl::DaeLoader::mDAE`[protected]`

Definition at line 122 of file DaeLoader.hpp.

Referenced by generateGeometry(), load(), and parseGeometry().

String vl::DaeLoader::mFilePath`[protected]`

Definition at line 123 of file DaeLoader.hpp.

Referenced by load().

mat4 vl::DaeLoader::mUpMatrix`[protected]`

Definition at line 124 of file DaeLoader.hpp.

Referenced by load(), and parseAsset().

bool vl::DaeLoader::mInvertTransparency`[protected]`

Definition at line 125 of file DaeLoader.hpp.

Referenced by parseAsset(), parseEffects(), and reset().

bool vl::DaeLoader::mAssumeOpaque`[protected]`

Definition at line 126 of file DaeLoader.hpp.

Referenced by parseAsset(), parseEffects(), reset(), and setup_vl_Effect().

The documentation for this class was generated from the following files:

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/plugins/COLLADA/DaeLoader.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/plugins/COLLADA/DaeLoader.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:41.
Permission is granted to use this page to write and publish articles regarding Visualization Library.