Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 14, 2012, 9:16:18 PM (11 years ago)
Author:
davidsa
Message:

Added Hardware Occlusion Query Capabilities for use in dynamic flare effects, this is still a pretty static implemenation, meaning it will fail with mutltiple HOQ objects on screen, also needs some tidying up and documentation at a later point

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/shaders/src/orxonox/RenderQueueListener.h

    r9419 r9448  
    3939
    4040#include <OgreRenderQueueListener.h>
     41#include <OgreHardwareOcclusionQuery.h>
    4142
    4243namespace orxonox
     
    4748        RENDER_QUEUE_STENCIL_OBJECTS = RENDER_QUEUE_MAIN+1,
    4849        RENDER_QUEUE_STENCIL_GLOW = RENDER_QUEUE_MAIN+2,
    49         RENDER_QUEUE_STENCIL_LAST = RENDER_QUEUE_STENCIL_GLOW //this is a reference to the last render queue to be affected by stencil glow effects
     50        RENDER_QUEUE_STENCIL_LAST = RENDER_QUEUE_STENCIL_GLOW, //this is a reference to the last render queue to be affected by stencil glow effects
     51        RENDER_QUEUE_HOQ = RENDER_QUEUE_STENCIL_LAST+1 //this is where we render the objects for occlusion queries (use transparent material)
    5052    };
    5153
     
    6567    {
    6668        public:
     69            RenderQueueListener();
     70            ~RenderQueueListener();
     71   
     72            /**
     73            @brief
     74            This function is returning the current pixel count and resets the pixel state if we're ready to do another Hardware Occlusion Query
     75           
     76            @return
     77            current pixel count taken from the last Hardware Occlusion Query
     78            */
     79            unsigned int getPixelCount();
     80           
    6781            /**
    6882            @brief
     
    7993            */
    8094            virtual void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation);
     95           
     96        private:
     97            Ogre::HardwareOcclusionQuery* hardwareOcclusionQuery_; //!< this stores the current instance of the HOQ used in the render system
     98            unsigned int pixelCount_; //!< this stores the last pixel count returned by the last HOQ in the corresponding render group
     99           
     100            enum PixelState //!< enum to distinguish the several HOQ pixel count states
     101            {
     102                READY_FOR_RENDER,
     103                QUERY_STARTED,
     104                READY_FOR_ACCESS
     105            };
     106           
     107            PixelState pixelState_; //!< this stores the current state of the Hardware Occlusion Query
    81108    };
    82109}
Note: See TracChangeset for help on using the changeset viewer.