# Visualization Library

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

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

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Rendering.hpp

Go to the documentation of this file.

    00001 /**************************************************************************************/
    00002 /*                                                                                    */
    00003 /*  Visualization Library                                                             */
    00004 /*  http://www.visualizationlibrary.com                                               */
    00005 /*                                                                                    */
    00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
    00007 /*  All rights reserved.                                                              */
    00008 /*                                                                                    */
    00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
    00010 /*  are permitted provided that the following conditions are met:                     */
    00011 /*                                                                                    */
    00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
    00013 /*  list of conditions and the following disclaimer.                                  */
    00014 /*                                                                                    */
    00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
    00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
    00017 /*  other materials provided with the distribution.                                   */
    00018 /*                                                                                    */
    00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
    00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
    00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
    00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
    00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
    00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
    00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
    00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
    00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
    00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
    00029 /*                                                                                    */
    00030 /**************************************************************************************/
    00031
    00032 #ifndef Rendering_INCLUDE_ONCE
    00033 #define Rendering_INCLUDE_ONCE
    00034
    00035 #include <vlGraphics/RenderingAbstract.hpp>
    00036 #include <vlGraphics/RenderQueueSorter.hpp>
    00037 #include <vlGraphics/Actor.hpp>
    00038 #include <vlGraphics/RenderQueue.hpp>
    00039 #include <vlGraphics/Renderer.hpp>
    00040 #include <vlGraphics/RenderTarget.hpp>
    00041 #include <vlGraphics/Camera.hpp>
    00042 #include <vlGraphics/SceneManager.hpp>
    00043 #include <vlCore/Transform.hpp>
    00044 #include <vlCore/Collection.hpp>
    00045
    00046 namespace vl
    00047 {
    00069   class VLGRAPHICS_EXPORT Rendering: public RenderingAbstract
    00070   {
    00071   public:
    00072     virtual const char* className() { return "vl::Rendering"; }
    00073
    00075     Rendering();
    00076
    00078     Rendering(const Rendering& other): RenderingAbstract(other) { *this = other; }
    00079
    00081     Rendering& operator=(const Rendering& other);
    00082
    00084     virtual void render();
    00085
    00087     void setRenderQueueSorter(RenderQueueSorter* render_queue_sorter) { mRenderQueueSorter = render_queue_sorter; }
    00088
    00090     RenderQueueSorter* renderQueueSorter() { return mRenderQueueSorter.get(); }
    00091
    00095     const std::vector< ref<Renderer> >& renderers() const { return mRenderers; }
    00096
    00100     std::vector< ref<Renderer> >& renderers() { return mRenderers; }
    00101
    00103     void setRenderer(Renderer* renderer)
    00104     {
    00105       renderers().clear();
    00106       renderers().push_back(renderer);
    00107     }
    00108
    00110     const Renderer* renderer() const
    00111     {
    00112       if (renderers().empty())
    00113         return NULL;
    00114       else
    00115         return renderers()[0].get();
    00116     }
    00117
    00119     Renderer* renderer()
    00120     {
    00121       if (renderers().empty())
    00122         return NULL;
    00123       else
    00124         return renderers()[0].get();
    00125     }
    00126
    00128     void setCamera(Camera* camera) { mCamera = camera; }
    00129
    00131     const Camera* camera() const { return mCamera.get(); }
    00132
    00134     Camera* camera() { return mCamera.get(); }
    00135
    00137     Collection<SceneManager>* sceneManagers() { return mSceneManagers.get(); }
    00138
    00140     const Collection<SceneManager>* sceneManagers() const { return mSceneManagers.get(); }
    00141
    00144     void setTransform(Transform* transform) { mTransform = transform; }
    00145
    00148     const Transform* transform() const { return mTransform.get(); }
    00149
    00152     Transform* transform() { return mTransform.get(); }
    00153
    00155     void setEvaluateLOD(bool evaluate_lod) { mEvaluateLOD = evaluate_lod; }
    00156
    00158     bool evaluateLOD() const { return mEvaluateLOD; }
    00159
    00163     void setShaderAnimationEnabled(bool animate_shaders) { mShaderAnimationEnabled = animate_shaders; }
    00164
    00168     bool shaderAnimationEnabled() const { return mShaderAnimationEnabled; }
    00169
    00171     void setCullingEnabled(bool enabled) { mCullingEnabled = enabled; }
    00172
    00174     bool cullingEnabled() const { return mCullingEnabled; }
    00175
    00179     void setAutomaticResourceInit(bool enable) { mAutomaticResourceInit = enable; }
    00180
    00182     bool automaticResourceInit() const { return mAutomaticResourceInit; }
    00183
    00185     bool nearFarClippingPlanesOptimized() const { return mNearFarClippingPlanesOptimized; }
    00186
    00191     void setNearFarClippingPlanesOptimized(bool enabled) { mNearFarClippingPlanesOptimized = enabled; }
    00192
    00194     const std::map<unsigned int, ref<Effect> >& effectOverrideMask() const { return mEffectOverrideMask; }
    00195
    00197     std::map<unsigned int, ref<Effect> >& effectOverrideMask() { return mEffectOverrideMask; }
    00198
    00199   protected:
    00200     void fillRenderQueue( ActorCollection* actor_list );
    00201     ActorCollection* actorQueue() { return mActorQueue.get(); }
    00202     RenderQueue* renderQueue() { return mRenderQueue.get(); }
    00203
    00204   protected:
    00205     ref<RenderQueueSorter> mRenderQueueSorter;
    00206     ref<ActorCollection> mActorQueue;
    00207     ref<RenderQueue> mRenderQueue;
    00208     std::vector< ref<Renderer> > mRenderers;
    00209     ref<Camera> mCamera;
    00210     ref<Transform> mTransform;
    00211     ref<Collection<SceneManager> > mSceneManagers;
    00212     std::map<unsigned int, ref<Effect> > mEffectOverrideMask;
    00213
    00214     bool mAutomaticResourceInit;
    00215     bool mCullingEnabled;
    00216     bool mEvaluateLOD;
    00217     bool mShaderAnimationEnabled;
    00218     bool mNearFarClippingPlanesOptimized;
    00219   };
    00220 }
    00221
    00222 #endif

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:24.
Permission is granted to use this page to write and publish articles regarding Visualization Library.