VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkXMLMaterialParser Class Reference

Parses VTK Material file. More...

#include <vtkXMLMaterialParser.h>

Inheritance diagram for vtkXMLMaterialParser:
[legend]
Collaboration diagram for vtkXMLMaterialParser:
[legend]

Public Types

typedef vtkXMLParser Superclass
 
- Public Types inherited from vtkXMLParser
typedef vtkObject Superclass
 
- Public Types inherited from vtkObject
typedef vtkObjectBase Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent)
 
virtual vtkXMLMaterialGetMaterial ()
 
void SetMaterial (vtkXMLMaterial *)
 
virtual int Parse ()
 
virtual int Parse (const char *inputString)
 
virtual int Parse (const char *inputString, unsigned int length)
 
- Public Member Functions inherited from vtkXMLParser
void PrintSelf (ostream &os, vtkIndent indent)
 
virtual void SetStream (istream *)
 
virtual istream * GetStream ()
 
long TellG ()
 
void SeekG (long position)
 
virtual int ParseChunk (const char *inputString, unsigned int length)
 
virtual int CleanupParser ()
 
virtual void SetFileName (const char *)
 
virtual char * GetFileName ()
 
virtual void SetIgnoreCharacterData (int)
 
virtual int GetIgnoreCharacterData ()
 
virtual void SetEncoding (const char *)
 
virtual char * GetEncoding ()
 
- Public Member Functions inherited from vtkObject
virtual void DebugOn ()
 
virtual void DebugOff ()
 
unsigned char GetDebug ()
 
void SetDebug (unsigned char debugFlag)
 
virtual void Modified ()
 
virtual unsigned long GetMTime ()
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
void PrintRevisions (ostream &os)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 

Static Public Member Functions

static vtkXMLMaterialParserNew ()
 
static int IsTypeOf (const char *type)
 
static vtkXMLMaterialParserSafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkXMLParser
static int IsTypeOf (const char *type)
 
static vtkXMLParserSafeDownCast (vtkObject *o)
 
static vtkXMLParserNew ()
 
- Static Public Member Functions inherited from vtkObject
static int IsTypeOf (const char *type)
 
static vtkObjectSafeDownCast (vtkObject *o)
 
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static int IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 

Protected Member Functions

virtual void StartElement (const char *name, const char **atts)
 
virtual void EndElement (const char *)
 
virtual void CharacterDataHandler (const char *data, int length)
 
- Protected Member Functions inherited from vtkXMLParser
 vtkXMLParser ()
 
 ~vtkXMLParser ()
 
virtual int CreateParser ()
 
virtual int ParseXML ()
 
virtual int ParsingComplete ()
 
virtual void ReportStrayAttribute (const char *element, const char *attr, const char *value)
 
virtual void ReportMissingAttribute (const char *element, const char *attr)
 
virtual void ReportBadAttribute (const char *element, const char *attr, const char *value)
 
virtual void ReportUnknownElement (const char *element)
 
virtual void ReportXmlParseError ()
 
unsigned long GetXMLByteIndex ()
 
virtual int ParseBuffer (const char *buffer, unsigned int count)
 
int ParseBuffer (const char *buffer)
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
virtual void RegisterInternal (vtkObjectBase *, int check)
 
virtual void UnRegisterInternal (vtkObjectBase *, int check)
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &os)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

vtkXMLMaterialMaterial
 
vtkXMLMaterialParserInternals * Internals
 
- Protected Attributes inherited from vtkXMLParser
istream * Stream
 
char * FileName
 
char * Encoding
 
int ParseError
 
const char * InputString
 
int InputStringLength
 
void * Parser
 
int IgnoreCharacterData
 
- Protected Attributes inherited from vtkObject
unsigned char Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
int ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 
virtual int InitializeParser ()
 
 vtkXMLMaterialParser ()
 
 ~vtkXMLMaterialParser ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkXMLParser
static int IsSpace (char c)
 
- Friends inherited from vtkObject

Detailed Description

Parses VTK Material file.

vtkXMLMaterialParser parses a VTK Material file and provides that file's description of a number of vertex and fragment shaders along with data values specified for data members of vtkProperty. This material is to be applied to an actor through it's vtkProperty and augments VTK's concept of a vtkProperty to include explicitly include vertex and fragment shaders and parameter settings for those shaders. This effectively makes reflectance models and other shaders a material property. If no shaders are specified VTK should default to standard rendering.

Design:
vtkXMLMaterialParser provides access to 3 distinct types of first-level vtkXMLDataElements that describe a VTK material. These elements are as follows:
Design:
vtkProperty - describe values for vtkProperty data members
Design:
vtkVertexShader - a vertex shader and enough information to install it into the hardware rendering pipeline including values for specific shader parameters and structures.
Design:
vtkFragmentShader - a fragment shader and enough information to install it into the hardware rendering pipeline including values for specific shader parameters and structures.
Design:
The design of the material file closely follows that of vtk's xml descriptions of it's data sets. This allows use of the very handy vtkXMLDataElement which provides easy access to an xml element's attribute values. Inlined data is currently not handled.
Design:
Ideally this class would be a Facade to a DOM parser, but VTK only provides access to expat, a SAX parser. Other vtk classes that parse xml files are tuned to read vtkDataSets and don't provide the functionality to handle generic xml data. As such they are of little use here.
Design:
This class may be extended for better data handling or may become a Facade to a DOM parser should on become part of the VTK code base.
Thanks:
Shader support in VTK includes key contributions by Gary Templet at Sandia National Labs.

Definition at line 84 of file vtkXMLMaterialParser.h.

Member Typedef Documentation

Definition at line 88 of file vtkXMLMaterialParser.h.

Constructor & Destructor Documentation

vtkXMLMaterialParser::vtkXMLMaterialParser ( )
protected

Overridden to clean up internal structures before the chunk-parsing begins.

vtkXMLMaterialParser::~vtkXMLMaterialParser ( )
protected

Overridden to clean up internal structures before the chunk-parsing begins.

Member Function Documentation

static vtkXMLMaterialParser* vtkXMLMaterialParser::New ( )
static
virtual const char* vtkXMLMaterialParser::GetClassName ( )
virtual

Reimplemented from vtkXMLParser.

static int vtkXMLMaterialParser::IsTypeOf ( const char *  type)
static
virtual int vtkXMLMaterialParser::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkXMLParser.

static vtkXMLMaterialParser* vtkXMLMaterialParser::SafeDownCast ( vtkObject o)
static
void vtkXMLMaterialParser::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

virtual vtkXMLMaterial* vtkXMLMaterialParser::GetMaterial ( )
virtual

Set/Get the vtkXMLMaterial representation of the parsed material.

void vtkXMLMaterialParser::SetMaterial ( vtkXMLMaterial )

Set/Get the vtkXMLMaterial representation of the parsed material.

virtual int vtkXMLMaterialParser::Parse ( )
virtual

Overridden to initialize the internal structures before the parsing begins.

Reimplemented from vtkXMLParser.

virtual int vtkXMLMaterialParser::Parse ( const char *  inputString)
virtual

Overridden to initialize the internal structures before the parsing begins.

Reimplemented from vtkXMLParser.

virtual int vtkXMLMaterialParser::Parse ( const char *  inputString,
unsigned int  length 
)
virtual

Overridden to initialize the internal structures before the parsing begins.

Reimplemented from vtkXMLParser.

virtual int vtkXMLMaterialParser::InitializeParser ( )
virtual

Overridden to clean up internal structures before the chunk-parsing begins.

Reimplemented from vtkXMLParser.

virtual void vtkXMLMaterialParser::StartElement ( const char *  name,
const char **  atts 
)
protectedvirtual

Event for handling the start of an element

Reimplemented from vtkXMLParser.

virtual void vtkXMLMaterialParser::EndElement ( const char *  )
protectedvirtual

Event for handling the end of an element

Reimplemented from vtkXMLParser.

virtual void vtkXMLMaterialParser::CharacterDataHandler ( const char *  data,
int  length 
)
protectedvirtual

Handle character data, not yet implemented

Reimplemented from vtkXMLParser.

Member Data Documentation

vtkXMLMaterial* vtkXMLMaterialParser::Material
protected

Definition at line 123 of file vtkXMLMaterialParser.h.

vtkXMLMaterialParserInternals* vtkXMLMaterialParser::Internals
protected

Definition at line 124 of file vtkXMLMaterialParser.h.


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