VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Rendering
vtkShaderProgram.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkShaderProgram.h
5
6
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7
All rights reserved.
8
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10
This software is distributed WITHOUT ANY WARRANTY; without even
11
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
PURPOSE. See the above copyright notice for more information.
13
14
=========================================================================*/
15
/*
16
* Copyright 2004 Sandia Corporation.
17
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
18
* license for use of this work by or on behalf of the
19
* U.S. Government. Redistribution and use in source and binary forms, with
20
* or without modification, are permitted provided that this Notice and any
21
* statement of authorship are reproduced on all copies.
22
*/
23
52
#ifndef __vtkShaderProgram_h
53
#define __vtkShaderProgram_h
54
55
#include "
vtkObject.h
"
56
57
class
vtkActor
;
58
class
vtkCollection
;
59
class
vtkCollectionIterator
;
60
class
vtkRenderer
;
61
class
vtkRenderWindow
;
62
class
vtkShader
;
63
class
vtkWindow
;
64
class
vtkXMLMaterial
;
65
class
vtkShaderDeviceAdapter
;
66
67
// manages all shaders defined in the XML file
68
// especially the part about sending things to the card
69
class
VTK_RENDERING_EXPORT
vtkShaderProgram
:
public
vtkObject
70
{
71
public
:
72
vtkTypeMacro(
vtkShaderProgram
,
vtkObject
);
73
void
PrintSelf
(ostream &os,
vtkIndent
indent);
74
75
// .Description:
76
// Accessors for the Material.
77
vtkGetObjectMacro(
Material
,
vtkXMLMaterial
);
78
virtual
void
SetMaterial(
vtkXMLMaterial
* );
79
80
// .Description:
81
// Add shaders. Returns the index of the shader.
82
int
AddShader(
vtkShader
* shader);
83
85
void
RemoveShader(
int
index
);
86
88
void
RemoveShader(
vtkShader
* shader);
89
91
vtkCollectionIterator
* NewShaderIterator();
92
94
int
GetNumberOfShaders();
95
96
// .Description
97
// This static function creates concrete shaders of a specific type. This is
98
// used to create a shader of the langauge specified in the XML file.
99
static
vtkShaderProgram
* CreateShaderProgram(
int
type
);
100
101
// .Description
102
// Read the material file to get necessary shader info. Synchronize with
103
// delegate shaders.
104
virtual
void
ReadMaterial();
105
106
// .Description
107
// Load, compile, install and initialize shaders. These operations may
108
// be delegated to the shaders themselves or handled in descendants of
109
// this class.
110
virtual
void
Render(
vtkActor
*,
vtkRenderer
* )=0;
111
113
117
virtual
void
AddShaderVariable(
const
char
*
name
,
int
numVars,
int
* x);
118
virtual
void
AddShaderVariable(
const
char
*
name
,
int
numVars,
float
* x);
119
virtual
void
AddShaderVariable(
const
char
*
name
,
int
numVars,
double
* x);
121
123
virtual
void
PostRender(
vtkActor
*,
vtkRenderer
*);
124
128
virtual
void
ReleaseGraphicsResources(
vtkWindow
*);
129
131
133
vtkGetObjectMacro(ShaderDeviceAdapter,
vtkShaderDeviceAdapter
);
135
136
protected
:
137
vtkShaderProgram
();
138
~
vtkShaderProgram
();
139
140
vtkXMLMaterial
*
Material
;
141
vtkCollection
*
ShaderCollection
;
142
vtkCollectionIterator
*
ShaderCollectionIterator
;
143
144
vtkSetMacro(GLExtensionsLoaded,
int
);
145
vtkGetMacro(GLExtensionsLoaded,
int
);
146
int
GLExtensionsLoaded
;
147
virtual
void
LoadExtensions
(
vtkRenderWindow
*) {}
148
149
// Subclasses must set the shader device apater of the right type.
150
void
SetShaderDeviceAdapter(
vtkShaderDeviceAdapter
*);
151
153
155
virtual
vtkShader
* NewShader() =0;
156
private
:
157
vtkShaderProgram
(
const
vtkShaderProgram
&);
// Not Implemented
158
void
operator=(
const
vtkShaderProgram
&);
// Not Implemented
160
161
vtkShaderDeviceAdapter
* ShaderDeviceAdapter;
162
};
163
#endif //__vtkShaderProgram_h
Generated on Fri Aug 2 2013 12:20:02 for VTK by
1.8.4