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

Program Class Reference

#include <program.h>

Inheritance diagram for Program:

Inheritance graph
[legend]
Collaboration diagram for Program:

Collaboration graph
[legend]
List of all members.

Detailed Description

Pipeline program Base class for pipeline programs, real implementation created by render device The program expects source code in format compatible with the target for the type of program that the render device selects during initialization. Programs are reference counted and should always be accessed through a smart pointer. When a program is loaded from file, the name of the program is automatically set to the base file name (i.e without extension).

Author:
Matt Holmes (kerion@houston.rr.com)

Cody Russell (cody [at] jhu.edu)

Mattias Jansson (mattias@realityrift.com)


Public Types

enum  PROGRAMTYPE { VERTEXPROGRAM = 0, FRAGMENTPROGRAM = 1 }
 Program type identifier. More...

enum  PROGRAMTARGET {
  NOTSUPPORTED = 0, NEPT_DX9_VS_MASK = 0x110, NEPT_DX9_VS_1_1 = 0x111, NEPT_DX9_VS_2_0 = 0x112,
  NEPT_DX9_VS_2_X = 0x113, NEPT_DX9_PS_MASK = 0x120, NEPT_DX9_PS_1_1 = 0x121, NEPT_DX9_PS_1_2 = 0x122,
  NEPT_DX9_PS_1_3 = 0x123, NEPT_DX9_PS_1_4 = 0x124, NEPT_DX9_PS_2_0 = 0x125, NEPT_DX9_PS_2_X = 0x126,
  NEPT_GL_VP_MASK = 0x210, NEPT_GL_ARBVP_1 = 0x211, NEPT_GL_FP_MASK = 0x220, NEPT_GL_ARBFP_1 = 0x221,
  NEPT_GL_ATIFS = 0x222, NEPT_GL_NVRC = 0x223, NEPT_GL_NVRC_2 = 0x224
}
 Supported pipeline program native types. More...


Public Member Functions

 Program (PROGRAMTYPE eType, FileManager *pkFileManager=0)
virtual ~Program ()
virtual bool Compile (const std::string *pstrSource=0)=0
virtual void SetName (const HashString &rstrName)
const HashStringGetName () const
unsigned int GetID () const
ProgramParamGetParameter (const HashString &rstrName)
ProgramParamGetParameter (unsigned int uiIndex)
const std::vector< ProgramParam * > & GetAllParameters ()
void UpdateParameter (ProgramParam *pkParameter)
PROGRAMTYPE GetType () const
void IncRef ()
void DecRef ()
int GetRefCount () const
void SetFileManager (FileManager *pkManager)
bool Load (const std::string &rstrFilename, unsigned int uiFlags=0, bool bForceReload=false, bool bSearchFileSystem=false)
bool Load (File *pkFile, unsigned int uiFlags=0, bool bForceReload=false)

Static Public Member Functions

PROGRAMTARGET GetTarget (PROGRAMTYPE eType)
void SetPriority (PROGRAMTYPE eType, const std::vector< PROGRAMTARGET > &rvePriority)
std::string GetTargetAsString (PROGRAMTARGET eTarget)
PROGRAMTARGET GetTargetFromString (const std::string &rstrTarget)

Protected Member Functions

bool LoadNode (unsigned int uiFlags)
void ClearParams ()
void ParseParams ()

Protected Attributes

std::string m_strSource
PROGRAMTYPE m_eProgramType
HashString m_strName
unsigned int m_uiID
ProgramParamHash m_kParams
ProgramParam ** m_ppkParams
std::vector< ProgramParam * > m_vpkParams
std::vector< ProgramParam * > m_vpkUpdatedParams
Filem_pkFile
bool m_bLoaded
bool m_bKeepFile
FileManagerm_pkFileManager

Static Protected Attributes

NE_STATIC PROGRAMTARGET s_eVPTarget
NE_STATIC PROGRAMTARGET s_eFPTarget
NE_STATIC std::vector< PROGRAMTARGETs_veVPPriority
NE_STATIC std::vector< PROGRAMTARGETs_veFPPriority
NE_STATIC unsigned int s_uiCount


Member Enumeration Documentation

enum PROGRAMTYPE
 

Program type identifier.

Enumeration values:
VERTEXPROGRAM  Vertex program
FRAGMENTPROGRAM  Fragment program

enum PROGRAMTARGET
 

Supported pipeline program native types.

Enumeration values:
NOTSUPPORTED  Program type is not supported
NEPT_DX9_VS_MASK  DX9 vertex shader group
NEPT_DX9_VS_1_1  DX9 vertex shader 1.1
NEPT_DX9_VS_2_0  DX9 vertex shader 2.0
NEPT_DX9_VS_2_X  DX9 vertex shader 2.x
NEPT_DX9_PS_MASK  DX9 pixel shader group
NEPT_DX9_PS_1_1  DX9 pixel shader 1.1
NEPT_DX9_PS_1_2  DX9 pixel shader 1.2
NEPT_DX9_PS_1_3  DX9 pixel shader 1.3
NEPT_DX9_PS_1_4  DX9 pixel shader 1.4
NEPT_DX9_PS_2_0  DX9 pixel shader 2.0
NEPT_DX9_PS_2_X  DX9 pixel shader 2.x
NEPT_GL_VP_MASK  OpenGL vertex program group
NEPT_GL_ARBVP_1  OpenGL ARB_vertex_program extension
NEPT_GL_FP_MASK  OpenGL fragment program group
NEPT_GL_ARBFP_1  OpenGL ARB_fragment_program extension
NEPT_GL_ATIFS  OpenGL ATI_fragment_shader extension
NEPT_GL_NVRC  OpenGL NV_register_combiners extension
NEPT_GL_NVRC_2  OpenGL NV_register_combiners2 extension


Constructor & Destructor Documentation

Program PROGRAMTYPE  eType,
FileManager pkFileManager = 0
 

Construct a new pipeline program

Parameters:
eType The type of program to create (vertex or fragment)
pkFileManager File manager that loaded this shader program, will use core file manager if null (default)

virtual ~Program  )  [virtual]
 

Destroy this pipeline program instance


Member Function Documentation

bool LoadNode unsigned int  uiFlags  )  [protected, virtual]
 

Load the script source for this program from the given file

Parameters:
uiFlags Load flags
Returns:
True if loaded, or false

Implements LoadableEntity.

void ClearParams  )  [protected]
 

Delete and clear all parameters

void ParseParams  )  [protected]
 

Parse parameters and special neoengine comments for parameter bindings in the source

virtual bool Compile const std::string *  pstrSource = 0  )  [pure virtual]
 

Compile the program

Parameters:
pstrSource Pointer to source string, or null if already loaded
Returns:
True if succesful, false otherwise.

virtual void SetName const HashString rstrName  )  [virtual]
 

Set name of program

Parameters:
rstrName New name

const HashString& GetName  )  const [inline]
 

Returns:
Name of program

unsigned int GetID  )  const [inline]
 

Returns:
Program ID

ProgramParam* GetParameter const HashString rstrName  )  [inline]
 

Get named parameter

Parameters:
rstrName Name of parameter to get type of
Returns:
Parameter object

ProgramParam* GetParameter unsigned int  uiIndex  )  [inline]
 

Get parameter by index (register)

Parameters:
uiIndex Register index
Returns:
Parameter object

const std::vector< ProgramParam* >& GetAllParameters  )  [inline]
 

Get all parameters for program

Parameters:
pvpkParameters Pointer to vector receiving parameters

void UpdateParameter ProgramParam pkParameter  ) 
 

Notify program that parameter has been updated

Parameters:
pkParameter Parameter object

PROGRAMTYPE GetType  )  const [inline]
 

Returns:
Program type (vertex or fragment)

PROGRAMTARGET GetTarget PROGRAMTYPE  eType  )  [inline, static]
 

Parameters:
eType Program type (vertex or fragment)
Returns:
Current native target for program type

void SetPriority PROGRAMTYPE  eType,
const std::vector< PROGRAMTARGET > &  rvePriority
[static]
 

Set priority list of profiles for a program type. The backend will only choose among the profiles in this list and will choose profiles in the order of the list.

Parameters:
eType Program type (vertex or fragment)
rvePriority Vector of requested profiles in priority order (highest priority first)

std::string GetTargetAsString PROGRAMTARGET  eTarget  )  [static]
 

Get program target name as string

Parameters:
eTarget Program target identifier
Returns:
Name of program target as string

PROGRAMTARGET GetTargetFromString const std::string &  rstrTarget  )  [static]
 

Get program target identifier from string

Parameters:
rstrTarget Program target name as string
Returns:
Program target identifier

void IncRef  )  [inline, inherited]
 

Increase reference count

void DecRef  )  [inline, inherited]
 

Decrease reference count and garbage collect if 0

int GetRefCount  )  const [inline, inherited]
 

Returns:
Current reference count

void SetFileManager FileManager pkManager  )  [inherited]
 

Set new file manager object

Parameters:
pkManager Ptr to file manager object

bool Load const std::string &  rstrFilename,
unsigned int  uiFlags = 0,
bool  bForceReload = false,
bool  bSearchFileSystem = false
[inherited]
 

Load resource

Parameters:
rstrFilename Filename
uiFlags Flags to pass to loader
bForceReload Force reload if already loaded (default false)
bSearchFileSystem Look in normal file system for file if not found in file manager (default false)
Returns:
true if successful (or already loaded and not force flag set), false otherwise (load/reload failed)

bool Load File pkFile,
unsigned int  uiFlags = 0,
bool  bForceReload = false
[inherited]
 

Load resource

Parameters:
pkFile File object
uiFlags Flags to pass to loader
bForceReload Force reload if already loaded
Returns:
true if successful (or already loaded and not force flag set), false otherwise (load/reload failed)


Member Data Documentation

NE_STATIC PROGRAMTARGET s_eVPTarget [static, protected]
 

Current vertexprogram target, set by render device

NE_STATIC PROGRAMTARGET s_eFPTarget [static, protected]
 

Current fragmentprogram target, set by render device

NE_STATIC std::vector< PROGRAMTARGET > s_veVPPriority [static, protected]
 

Priority list of vertex program profiles requested by application

NE_STATIC std::vector< PROGRAMTARGET > s_veFPPriority [static, protected]
 

Priority list of fragment program profiles requested by application

NE_STATIC unsigned int s_uiCount [static, protected]
 

Program count

std::string m_strSource [protected]
 

Program source code

PROGRAMTYPE m_eProgramType [protected]
 

Program type

HashString m_strName [protected]
 

Program name

unsigned int m_uiID [protected]
 

Program ID

ProgramParamHash m_kParams [protected]
 

Hashtable of currently registered parameters

ProgramParam** m_ppkParams [protected]
 

Parameters by index

std::vector< ProgramParam* > m_vpkParams [protected]
 

All parameters

std::vector< ProgramParam* > m_vpkUpdatedParams [protected]
 

Parameters in need of rebinding

File* m_pkFile [protected, inherited]
 

File

bool m_bLoaded [protected, inherited]
 

Flag indicating node is loaded

bool m_bKeepFile [protected, inherited]
 

Flag to block file deletion on load completion

FileManager* m_pkFileManager [protected, inherited]
 

File manager


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:14 2004 for NeoEngine by doxygen 1.3.5