NL3D::CVertexArrayRangeMapObjectATI Class Reference

#include <driver_opengl_vertex_buffer_hard.h>

Inheritance diagram for NL3D::CVertexArrayRangeMapObjectATI:

NL3D::IVertexArrayRange

Detailed Description

TEMP nico : test if better with ATI_map_object_buffer We don't manage a heap there, we just allocate separate objects (can't get a pointer on a portion of the buffer only ..) todo : test if such maneer is still efficient (because of vb switching) NB : this is available only it GL_ATI_map_object_buffer is available

Definition at line 361 of file driver_opengl_vertex_buffer_hard.h.

Public Member Functions

 CVertexArrayRangeMapObjectATI (CDriverGL *drv)
void disable ()
void enable ()
Implementation
virtual bool allocate (uint32 size, IDriver::TVBHardType vbType)
virtual IVertexBufferHardGLcreateVBHardGL (uint16 vertexFormat, const uint8 *typeArray, uint32 numVertices, const uint8 *uvRouting)
 create a IVertexBufferHardGL

virtual void free ()
 free this space.

virtual uint sizeAllocated () const
 return the size allocated. 0 if not allocated or failure


Protected Attributes

CDriverGL_Driver

Private Attributes

uint32 _SizeAllocated
IDriver::TVBHardType _VBType


Constructor & Destructor Documentation

NL3D::CVertexArrayRangeMapObjectATI::CVertexArrayRangeMapObjectATI CDriverGL drv  ) 
 

Definition at line 719 of file driver_opengl_vertex_buffer_hard.cpp.

00719                                                                            : IVertexArrayRange(drv),
00720                                                                                                                                                            _VBType(IDriver::VBHardAGP),
00721                                                                                                                                                            _SizeAllocated(0)
00722 {
00723 }


Member Function Documentation

bool NL3D::CVertexArrayRangeMapObjectATI::allocate uint32  size,
IDriver::TVBHardType  vbType
[virtual]
 

Allocate a vertex array space. false if error. must free before re-allocate. Will always succeed, because vb are not managed in a heap, but are rather kept as separate objects

Implements NL3D::IVertexArrayRange.

Definition at line 726 of file driver_opengl_vertex_buffer_hard.cpp.

References _SizeAllocated, _VBType, GL_DYNAMIC_ATI, GL_STATIC_ATI, GLuint(), nglDeleteObjectBufferATI, nglNewObjectBufferATI, size, and uint32.

00727 {
00728         // We don't manage memory ourselves, but test if there's enough room anyway
00729         GLuint vertexObjectId;
00730         switch(vbType)
00731         {       
00732                 case IDriver::VBHardAGP: 
00733                         vertexObjectId = nglNewObjectBufferATI(size, NULL, GL_DYNAMIC_ATI);
00734                         break;
00735                 case IDriver::VBHardVRAM:
00736                         vertexObjectId = nglNewObjectBufferATI(size, NULL, GL_STATIC_ATI);
00737                         break;
00738         }
00739         if (vertexObjectId)
00740         {       
00741                 // free the object
00742                 nglDeleteObjectBufferATI(vertexObjectId);
00743                 //
00744                 _SizeAllocated = size;
00745                 _VBType = vbType;       
00746                 return true;
00747         }
00748         return false;
00749 }

IVertexBufferHardGL * NL3D::CVertexArrayRangeMapObjectATI::createVBHardGL uint16  vertexFormat,
const uint8 typeArray,
uint32  numVertices,
const uint8 uvRouting
[virtual]
 

create a IVertexBufferHardGL

Implements NL3D::IVertexArrayRange.

Definition at line 758 of file driver_opengl_vertex_buffer_hard.cpp.

References _VBType, NL3D::IVertexBufferHard::getNumVertices(), NL3D::IVertexBufferHard::getVertexSize(), GL_DYNAMIC_ATI, GL_STATIC_ATI, NL3D::IVertexBufferHardGL::initFormat(), NL3D::CVertexBufferHardGLMapObjectATI::initGL(), nglIsObjectBufferATI, nglNewObjectBufferATI, size, uint, uint16, uint32, and uint8.

00759 {
00760         // create a ATI VBHard
00761         CVertexBufferHardGLMapObjectATI *newVbHard= new CVertexBufferHardGLMapObjectATI(_Driver);
00762 
00763         // Init the format of the VB.
00764         newVbHard->initFormat(vertexFormat, typeArray, numVertices, uvRouting);
00765 
00766         // compute size to allocate.
00767         uint32  size= newVbHard->getVertexSize() * newVbHard->getNumVertices();
00768 
00769         uint vertexObjectId;
00770         // just allocate a new buffer..
00771         switch(_VBType)
00772         {
00773                 case IDriver::VBHardAGP: 
00774                         vertexObjectId = nglNewObjectBufferATI(size, NULL, GL_DYNAMIC_ATI);
00775                         break;
00776                 case IDriver::VBHardVRAM:
00777                         vertexObjectId = nglNewObjectBufferATI(size, NULL, GL_STATIC_ATI);
00778                         break;
00779         };
00780 
00781 
00782         // init the allocator, if success
00783         if( nglIsObjectBufferATI(vertexObjectId) )
00784         {
00785                 newVbHard->initGL(this, vertexObjectId);
00786                 return newVbHard;
00787         }
00788         else
00789         {
00790                 delete newVbHard;
00791                 return false;
00792         }
00793 }

void NL3D::CVertexArrayRangeMapObjectATI::disable  ) 
 

disable this VertexArrayRange. _Driver->_CurrentVertexArrayRange= NULL; NB: no-op for ATI, but ensure correct _Driver->_CurrentVertexArrayRange value.

Definition at line 801 of file driver_opengl_vertex_buffer_hard.cpp.

00802 {
00803 }

void NL3D::CVertexArrayRangeMapObjectATI::enable  ) 
 

active this VertexArrayRange as the current vertex array range used. no-op if already setup. NB: no-op for ATI, but ensure correct _Driver->_CurrentVertexArrayRange value.

Definition at line 796 of file driver_opengl_vertex_buffer_hard.cpp.

00797 {       
00798 }

void NL3D::CVertexArrayRangeMapObjectATI::free  )  [virtual]
 

free this space.

Implements NL3D::IVertexArrayRange.

Definition at line 752 of file driver_opengl_vertex_buffer_hard.cpp.

References _SizeAllocated.

00753 {
00754         _SizeAllocated = 0;
00755 }

virtual uint NL3D::CVertexArrayRangeMapObjectATI::sizeAllocated  )  const [inline, virtual]
 

return the size allocated. 0 if not allocated or failure

Implements NL3D::IVertexArrayRange.

Definition at line 378 of file driver_opengl_vertex_buffer_hard.h.

References _SizeAllocated, and uint.

00378 { return _SizeAllocated; }      


Field Documentation

CDriverGL* NL3D::IVertexArrayRange::_Driver [protected, inherited]
 

Definition at line 69 of file driver_opengl_vertex_buffer_hard.h.

uint32 NL3D::CVertexArrayRangeMapObjectATI::_SizeAllocated [private]
 

Definition at line 395 of file driver_opengl_vertex_buffer_hard.h.

Referenced by allocate(), free(), and sizeAllocated().

IDriver::TVBHardType NL3D::CVertexArrayRangeMapObjectATI::_VBType [private]
 

Definition at line 394 of file driver_opengl_vertex_buffer_hard.h.

Referenced by allocate(), and createVBHardGL().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 08:23:08 2004 for NeL by doxygen 1.3.6