/usr/include/vtk-5.10/vtkShaderProgram.h is in libvtk5-dev 5.10.1+dfsg-2.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkShaderProgram.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
// .NAME vtkShaderProgram
// .SECTION Description
// vtkShaderProgram is a superclass for managing Hardware Shaders
// defined in the XML Material file and interfacing VTK to those shaders.
// It's concrete descendants are responsible for installing vertex and
// fragment programs to the graphics hardware.
//
// .SECTION Shader Operations are shader library operations that are performed
// on individual shaders, that is, without consideration of the partner shader.
//
// .SECTION Program Operations are shader library operations that treat the
// vertex and fragment shader as a single unit.
//
// .SECTION Design
// This class is a Strategy pattern for 'Program' operations, which treat
// vertex/fragment shader pairs as a single 'Program', as required by some
// shader libraries (GLSL). Typically, 'Shader' operations are delegated
// to instances of vtkShader (managed by descendants of this class)
// while 'Program' operations are handled by descendants of this class,
// vtkCgShaderProgram, vtkGLSLShaderProgram.
//
// .SECTION See Also
// vtkCgShaderProgram, vtkGLSLShaderProgram
// .SECTION Thanks
// Shader support in VTK includes key contributions by Gary Templet at
// Sandia National Labs.
#ifndef __vtkShaderProgram_h
#define __vtkShaderProgram_h
#include "vtkObject.h"
class vtkActor;
class vtkCollection;
class vtkCollectionIterator;
class vtkRenderer;
class vtkRenderWindow;
class vtkShader;
class vtkWindow;
class vtkXMLMaterial;
class vtkShaderDeviceAdapter;
// manages all shaders defined in the XML file
// especially the part about sending things to the card
class VTK_RENDERING_EXPORT vtkShaderProgram : public vtkObject
{
public:
vtkTypeMacro(vtkShaderProgram, vtkObject);
void PrintSelf(ostream &os, vtkIndent indent);
// .Description:
// Accessors for the Material.
vtkGetObjectMacro( Material, vtkXMLMaterial);
virtual void SetMaterial( vtkXMLMaterial* );
// .Description:
// Add shaders. Returns the index of the shader.
int AddShader(vtkShader* shader);
// Description:
// Remove a shader at the given index.
void RemoveShader(int index);
// Description:
// Removes the given shader.
void RemoveShader(vtkShader* shader);
// Description:
// Returns a new iterator to iterate over the shaders.
vtkCollectionIterator* NewShaderIterator();
// Description:
// Returns the number of shaders available in this
// shader program.
int GetNumberOfShaders();
// .Description
// This static function creates concrete shaders of a specific type. This is
// used to create a shader of the langauge specified in the XML file.
static vtkShaderProgram* CreateShaderProgram( int type );
// .Description
// Read the material file to get necessary shader info. Synchronize with
// delegate shaders.
virtual void ReadMaterial();
// .Description
// Load, compile, install and initialize shaders. These operations may
// be delegated to the shaders themselves or handled in descendants of
// this class.
virtual void Render( vtkActor*, vtkRenderer* )=0;
//Description
// Provide values to initialize shader variables. This is a conduit to initialize
// shader variables that change over time, useful for animation, gui widget inputs,
// etc.
// name - hardware name of the uniform variable
// numVars - number of variables being set
// x - values
virtual void AddShaderVariable(const char* name, int numVars, int* x);
virtual void AddShaderVariable(const char* name, int numVars, float* x);
virtual void AddShaderVariable(const char* name, int numVars, double* x);
// Description:
// Called to unload the shaders after the actor has been rendered.
virtual void PostRender(vtkActor*, vtkRenderer*);
// Description:
// Release any graphics resources that are being consumed by this actor.
// The parameter window could be used to determine which graphic
// resources to release.
virtual void ReleaseGraphicsResources(vtkWindow *);
// Description:
// Get the vtkShaderDeviceAdapter which can be used to execute this
// shader program.
vtkGetObjectMacro(ShaderDeviceAdapter, vtkShaderDeviceAdapter);
protected:
vtkShaderProgram();
~vtkShaderProgram();
vtkXMLMaterial* Material;
vtkCollection* ShaderCollection;
vtkCollectionIterator* ShaderCollectionIterator;
vtkSetMacro(GLExtensionsLoaded, int);
vtkGetMacro(GLExtensionsLoaded, int);
int GLExtensionsLoaded;
virtual void LoadExtensions(vtkRenderWindow*) {}
// Subclasses must set the shader device apater of the right type.
void SetShaderDeviceAdapter(vtkShaderDeviceAdapter*);
// Description:;
// Must be overloaded by subclasses to create the shader of appropriate type.
virtual vtkShader* NewShader() =0;
private:
vtkShaderProgram(const vtkShaderProgram&); // Not Implemented
void operator=(const vtkShaderProgram&); // Not Implemented
vtkShaderDeviceAdapter* ShaderDeviceAdapter;
};
#endif //__vtkShaderProgram_h
|