Project

General

Profile

SO3Engine
SO3::SSubEntitySelectorBuffer Class Reference

#include <SO3SubEntitySelectorBuffer.h>

Inheritance diagram for SO3::SSubEntitySelectorBuffer:

Public Member Functions

 SSubEntitySelectorBuffer (SWindow *targetWindow, bool useDepth=true)
 
 ~SSubEntitySelectorBuffer ()
 
void DestroyBuffers ()
 
void CreateBuffers ()
 
void AddViewport (SViewPort *newViewport)
 
void RemoveViewport (SViewPort *existingViewport)
 
Ogre::SubEntity * GetSelectedSubEntity (int posX, int posY)
 
float GetSelectedZdepth (int posX, int posY)
 
virtual void preRenderTargetUpdate (const Ogre::RenderTargetEvent &evt)
 
virtual void postRenderTargetUpdate (const Ogre::RenderTargetEvent &evt)
 
void Update ()
 
void UpdateBufferSize (const bool &forceRefresh)
 
void CreatePicker ()
 
void DeletePicker ()
 
bool UseDepthBuffer ()
 

Detailed Description

The following class are a C++ implementation of a pixel perfect object selection mechanism. It works by rendering a single frame to a texture with custom substituted materials that colorize each subentity with a unique color (up to 2^24 colors/objects). The SSubEntityMaterialSwitcher class saves which color belongs to which subentity. The SSubEntitySelectionBuffer class then retrieves the correct SubEntity from the SceneManager Adapted from http://www.ogre3d.org/tikiwiki/Selection+Buffer&structure=Cookbook and http://wiki.python-ogre.org/index.php/CodeSnippets_Selection_Buffer. The main difference is that we assign a colour per sub-entity, instead of one colour per entity, to make the picking more precise. Doing that, we can do a raycast to the polygon level on a subentity instead of parsing all the subentities of an entity. The other difference is that we manage multiples scenes on a render window, multiples viewports, and camera switching.

Definition at line 56 of file SO3SubEntitySelectorBuffer.h.

Constructor & Destructor Documentation

◆ SSubEntitySelectorBuffer()

SO3::SSubEntitySelectorBuffer::SSubEntitySelectorBuffer ( SWindow targetWindow,
bool  useDepth = true 
)

Definition at line 44 of file SO3SubEntitySelectorBuffer.cpp.

◆ ~SSubEntitySelectorBuffer()

SO3::SSubEntitySelectorBuffer::~SSubEntitySelectorBuffer ( )

Definition at line 104 of file SO3SubEntitySelectorBuffer.cpp.

Member Function Documentation

◆ AddViewport()

void SO3::SSubEntitySelectorBuffer::AddViewport ( SViewPort newViewport)

Definition at line 256 of file SO3SubEntitySelectorBuffer.cpp.

◆ CreateBuffers()

void SO3::SSubEntitySelectorBuffer::CreateBuffers ( )

Definition at line 122 of file SO3SubEntitySelectorBuffer.cpp.

◆ CreatePicker()

void SO3::SSubEntitySelectorBuffer::CreatePicker ( )

Definition at line 131 of file SO3SubEntitySelectorBuffer.cpp.

◆ DeletePicker()

void SO3::SSubEntitySelectorBuffer::DeletePicker ( )

Definition at line 219 of file SO3SubEntitySelectorBuffer.cpp.

◆ DestroyBuffers()

void SO3::SSubEntitySelectorBuffer::DestroyBuffers ( )

Definition at line 116 of file SO3SubEntitySelectorBuffer.cpp.

◆ GetSelectedSubEntity()

Ogre::SubEntity * SO3::SSubEntitySelectorBuffer::GetSelectedSubEntity ( int  posX,
int  posY 
)

Return the subentity that is under the given screen coordinates.

Definition at line 277 of file SO3SubEntitySelectorBuffer.cpp.

◆ GetSelectedZdepth()

float SO3::SSubEntitySelectorBuffer::GetSelectedZdepth ( int  posX,
int  posY 
)

Return the Z depth that is under the given screen coordinates.

Definition at line 349 of file SO3SubEntitySelectorBuffer.cpp.

◆ postRenderTargetUpdate()

void SO3::SSubEntitySelectorBuffer::postRenderTargetUpdate ( const Ogre::RenderTargetEvent &  evt)
virtual

Definition at line 774 of file SO3SubEntitySelectorBuffer.cpp.

◆ preRenderTargetUpdate()

void SO3::SSubEntitySelectorBuffer::preRenderTargetUpdate ( const Ogre::RenderTargetEvent &  evt)
virtual

Definition at line 737 of file SO3SubEntitySelectorBuffer.cpp.

◆ RemoveViewport()

void SO3::SSubEntitySelectorBuffer::RemoveViewport ( SViewPort existingViewport)

Definition at line 263 of file SO3SubEntitySelectorBuffer.cpp.

◆ Update()

void SO3::SSubEntitySelectorBuffer::Update ( )

Definition at line 686 of file SO3SubEntitySelectorBuffer.cpp.

◆ UpdateBufferSize()

void SO3::SSubEntitySelectorBuffer::UpdateBufferSize ( const bool &  forceRefresh)

Definition at line 715 of file SO3SubEntitySelectorBuffer.cpp.

◆ UseDepthBuffer()

bool SO3::SSubEntitySelectorBuffer::UseDepthBuffer ( )

Definition at line 272 of file SO3SubEntitySelectorBuffer.cpp.


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