Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# Ogre::D3D9HardwareOcclusionQuery Class Reference

This is a class that is the DirectX9 implementation of hardware occlusion testing. More...

`#include <OgreD3D9HardwareOcclusionQuery.h>`

Inheritance diagram for Ogre::D3D9HardwareOcclusionQuery:

[legend]
List of all members.

## Public Methods

| D3D9HardwareOcclusionQuery (IDirect3DDevice9 *pD3DDevice)
| Default object constructor.
| ~D3D9HardwareOcclusionQuery ()
| Object destructor.
void | beginOcclusionQuery ()
| Starts the hardware occlusion query @Remarks Simple usage: Create one or more OcclusionQuery object one per outstanding query or one per tested object OcclusionQuery* m_pOcclusionQuery; createOcclusionQuery( &m_pOcclusionQuery ); In the rendering loop: Draw all occluders m_pOcclusionQuery->startOcclusionQuery(); Draw the polygons to be tested m_pOcclusionQuery->endOcclusionQuery();.
void | endOcclusionQuery ()
| Ends the hardware occlusion test.
bool | pullOcclusionQuery (unsigned int *NumOfFragments)
| Pulls the hardware occlusion query too see if there is a result.
bool | pullOcclusionQuery (unsigned int *NumOfFragments, const HW_OCCLUSIONQUERY flag)
| Pulls the hardware occlusion query too see if there is a result.
unsigned int | getLastQuerysPixelcount ()
| Let's you get the last pixel count with out doing the hardware occlusion test.
void | setSkipRate (int skip)
| Remarks This function allows you to set how often the hardware occlusion really are sent to the driver if you set it to 0 every hw occlusion test is acctually made.
int | getSkipRate ()

## Protected Attributes

unsigned int | m_uintPixelCount
IDirect3DQuery9 * | m_pD3DQuery
IDirect3DDevice9 * | m_pD3DDevice
bool | m_bOcclusionQuery
int | m_SkipCounter
bool | m_bHWOcclusionSupport

## Static Protected Attributes

int | m_Skip = 0

## Detailed Description

This is a class that is the DirectX9 implementation of hardware occlusion testing.

Author:
  Lee Sandberg, email lee@abcmedia.se

Definition at line 49 of file OgreD3D9HardwareOcclusionQuery.h.

## Constructor & Destructor Documentation

Ogre::D3D9HardwareOcclusionQuery::D3D9HardwareOcclusionQuery | ( | IDirect3DDevice9 * | pD3DDevice | ) |

| Default object constructor. Definition at line 44 of file OgreD3D9HardwareOcclusionQuery.cpp. References m_bHWOcclusionSupport, m_pD3DDevice, m_pD3DQuery, m_SkipCounter, and m_uintPixelCount.

Ogre::D3D9HardwareOcclusionQuery::~D3D9HardwareOcclusionQuery | ( |  | ) |

| Object destructor. Definition at line 68 of file OgreD3D9HardwareOcclusionQuery.cpp. References m_pD3DQuery, and SAFE_RELEASE.

## Member Function Documentation

void Ogre::D3D9HardwareOcclusionQuery::beginOcclusionQuery | ( |  | ) | `[virtual]`

Starts the hardware occlusion query @Remarks Simple usage: Create one or more OcclusionQuery object one per outstanding query or one per tested object OcclusionQuery* m_pOcclusionQuery; createOcclusionQuery( &m_pOcclusionQuery ); In the rendering loop: Draw all occluders m_pOcclusionQuery->startOcclusionQuery(); Draw the polygons to be tested m_pOcclusionQuery->endOcclusionQuery();.

Results must be pulled using: UINT m_uintNumberOfPixelsVisable; pullOcclusionQuery( &m_dwNumberOfPixelsVisable ); You may not get the result directlly after the first pass or frame. Objects not visable must be tested every frame, visable objects may be tested less freqvent.

Implements Ogre::HardwareOcclusionQuery.

Definition at line 76 of file OgreD3D9HardwareOcclusionQuery.cpp.

References m_pD3DQuery, m_Skip, m_SkipCounter, and m_uintPixelCount.

void Ogre::D3D9HardwareOcclusionQuery::endOcclusionQuery | ( |  | ) | `[virtual]`

| Ends the hardware occlusion test. Implements Ogre::HardwareOcclusionQuery. Definition at line 89 of file OgreD3D9HardwareOcclusionQuery.cpp. References m_pD3DQuery, m_SkipCounter, and m_uintPixelCount.

unsigned int Ogre::D3D9HardwareOcclusionQuery::getLastQuerysPixelcount | ( |  | ) | `[virtual]`

Let's you get the last pixel count with out doing the hardware occlusion test.

Returns:
  The last fragment count from the last test. Remarks This function won't give you new values, just the old value.

Implements Ogre::HardwareOcclusionQuery.

Definition at line 75 of file OgreD3D9HardwareOcclusionQuery.h.

References m_uintPixelCount.

int Ogre::D3D9HardwareOcclusionQuery::getSkipRate | ( |  | ) | `[virtual]`

| Implements Ogre::HardwareOcclusionQuery. Definition at line 94 of file OgreD3D9HardwareOcclusionQuery.h. References m_Skip.

bool Ogre::D3D9HardwareOcclusionQuery::pullOcclusionQuery | ( | unsigned int * | NumOfFragments,
|  | const HW_OCCLUSIONQUERY | flag
| ) | `[virtual]`

Pulls the hardware occlusion query too see if there is a result.

Return values:

  NumOfFragments | will get the resulting number of fragments.

Returns:
  True if success or false if not. @Remarks In DX9 mode specifying OCCLUSIONQUERY_FLUSH as the flag, will case the driver to flush whatever API calls are batched. In OpenGL mode it makes no difference if you specify OCCLUSIONQUERY_FLUSH or OCCLUSIONQUERY_NOFLUSH.

Implements Ogre::HardwareOcclusionQuery.

Definition at line 137 of file OgreD3D9HardwareOcclusionQuery.cpp.

References Ogre::HW_OCCLUSIONQUERY, Ogre::HWOCCLUSIONQUERY_FLUSH, Ogre::HWOCCLUSIONQUERY_NOFLUSH, m_pD3DQuery, and m_uintPixelCount.

bool Ogre::D3D9HardwareOcclusionQuery::pullOcclusionQuery | ( | unsigned int * | NumOfFragments | ) | `[virtual]`

Pulls the hardware occlusion query too see if there is a result.

Return values:

  NumOfFragments | will get the resulting number of fragments.

Returns:
  True if success or false if not. @Remarks Hardware occlusion is an assyncronius process the result may take a frame or so. one idea is to test pass1 and if not visable skip pass2. Also note that objects not visable must be tested evrey frame. Visable objects don't need testing every frame. Testing non visable objects can be don unlit, no texture with low LOD object. 0 will generate all the levels till 1x1. [default: 0]

Implements Ogre::HardwareOcclusionQuery.

Definition at line 106 of file OgreD3D9HardwareOcclusionQuery.cpp.

References m_pD3DQuery, and m_uintPixelCount.

void Ogre::D3D9HardwareOcclusionQuery::setSkipRate | ( | int | skip | ) | `[virtual]`

Remarks This function allows you to set how often the hardware occlusion really are sent to the driver if you set it to 0 every hw occlusion test is acctually made.

If you set it to 1 only the half of your queries are sent for all visable objects. 2 will result in 25% of all queries to acctualy be sent. New and none visable objects will be tested all the time. This functionality is here because this class can keep track on visable and none visable objects for you. Once you you set the SkipRate for any hardware occlusion instance it effects all others.

Implements Ogre::HardwareOcclusionQuery.

Definition at line 93 of file OgreD3D9HardwareOcclusionQuery.h.

References m_Skip.

## Member Data Documentation

bool Ogre::D3D9HardwareOcclusionQuery::m_bHWOcclusionSupport`[protected]`

| Definition at line 107 of file OgreD3D9HardwareOcclusionQuery.h. Referenced by D3D9HardwareOcclusionQuery().

bool Ogre::D3D9HardwareOcclusionQuery::m_bOcclusionQuery`[protected]`

| Definition at line 104 of file OgreD3D9HardwareOcclusionQuery.h.

IDirect3DDevice9* Ogre::D3D9HardwareOcclusionQuery::m_pD3DDevice`[protected]`

| Definition at line 103 of file OgreD3D9HardwareOcclusionQuery.h. Referenced by D3D9HardwareOcclusionQuery().

IDirect3DQuery9* Ogre::D3D9HardwareOcclusionQuery::m_pD3DQuery`[protected]`

| Definition at line 102 of file OgreD3D9HardwareOcclusionQuery.h. Referenced by beginOcclusionQuery(), D3D9HardwareOcclusionQuery(), endOcclusionQuery(), pullOcclusionQuery(), and ~D3D9HardwareOcclusionQuery().

int Ogre::D3D9HardwareOcclusionQuery::m_Skip = 0`[static, protected]`

| Definition at line 31 of file OgreD3D9HardwareOcclusionQuery.cpp. Referenced by beginOcclusionQuery(), getSkipRate(), and setSkipRate().

int Ogre::D3D9HardwareOcclusionQuery::m_SkipCounter`[protected]`

| Definition at line 105 of file OgreD3D9HardwareOcclusionQuery.h. Referenced by beginOcclusionQuery(), D3D9HardwareOcclusionQuery(), and endOcclusionQuery().

unsigned int Ogre::D3D9HardwareOcclusionQuery::m_uintPixelCount`[protected]`

| Definition at line 101 of file OgreD3D9HardwareOcclusionQuery.h. Referenced by beginOcclusionQuery(), D3D9HardwareOcclusionQuery(), endOcclusionQuery(), getLastQuerysPixelcount(), and pullOcclusionQuery().

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

- OgreD3D9HardwareOcclusionQuery.h
- OgreD3D9HardwareOcclusionQuery.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:49:25 2004