Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
oivShaderState.h File Reference

This file contains fonction to acces built-in GLSL uniforms. More...

Go to the source code of this file.

Macros

#define OIV_PROJECTION_TYPE_ORTHO   0
 
#define OIV_PROJECTION_TYPE_PERSPECTIVE   1
 
#define OIV_LIGHT_TYPE_NONE   0
 
#define OIV_LIGHT_TYPE_POINT   1
 
#define OIV_LIGHT_TYPE_SPOT   2
 
#define OIV_LIGHT_TYPE_DIRECTIONAL   3
 

Functions

int OivMaxLights ()
 Get the maximum number of lights sets by Open Inventor.
 
int OivMaxClipPlanes ()
 Get the maximum number of clipping planes sets by Open Inventor.
 
int OivMaxTextureCoordinates ()
 Get the maximum number of texture coordinates sets by Open Inventor.
 
int OivMaxTextureUnits ()
 Get the maximum number of texture units sets by Open Inventor.
 
mat4 OivModelMatrix ()
 Get transformation of the model (M).
 
mat4 OivModelMatrixInverse ()
 Get inverse transformation of the model (M^{-1}).
 
mat4 OivViewMatrix ()
 Get transformation of the view (V).
 
mat4 OivViewMatrixInverse ()
 Get inverse transformation of the view (V^{-1}).
 
mat4 OivModelViewMatrix ()
 Get the combination of model and view transformations (MV), i.e., MV = V * M.
 
mat4 OivModelViewMatrixInverse ()
 Get the inverse of the model-view matrix,.
 
mat3 OivNormalMatrix ()
 Get the normal matrix (N), i.e., N = tr(MV^{-1}).
 
mat4 OivProjectionMatrix ()
 Get the projection matrix (P).
 
mat4 OivProjectionMatrixInverse ()
 Get the inverse of the projection matrix (P^{-1}).
 
mat4 OivModelViewProjectionMatrix ()
 Get the combination of projection and model-view matrices (MVP), i.e., MVP = P * V * M.
 
mat4 OivTextureMatrix (int unit)
 Get texture matrices.
 
vec2 OivViewportSize ()
 Get the size of the viewport.
 
vec2 OivViewVolumeSize ()
 Get the near/far view volume of the camera.
 
int OivViewProjectionType ()
 Get the projection type of the camera (OIV_PROJECTION_TYPE_ORTHO or OIV_PROJECTION_TYPE_PERSPECTIVE)
 
bool OivHasLighting ()
 Ask if lighting is enabled.
 
bool OivHasTwoSidedLighting ()
 Ask if two-sided lighting is enabled.
 
bool OivHasPerPixelLighting ()
 Ask if per-pixel lighting is enabled.
 
bool OivHasColorMaterial ()
 Ask if color material is enabled.
 
vec4 OivGlobalAmbient ()
 Gets the global ambient color value.
 
bool OivLightSourceEnabled (int id)
 Ask if the light is enabled.
 
int OivLightSourceType (int id)
 Get the type of the light.
 
vec4 OivLightSourcePosition (int id)
 Get the light position.
 
vec3 OivLightSourceSpotDirection (int id)
 Get the light spot direction.
 
float OivLightSourceSpotExponent (int id)
 Get the light spot exponent.
 
float OivLightSourceSpotCutoff (int id)
 Get the light spot cutoff.
 
float OivLightSourceSpotCosCutoff (int id)
 Get the light spot cutoff cosine.
 
vec4 OivLightSourceAmbient (int id)
 Get the light ambient color.
 
vec4 OivLightSourceDiffuse (int id)
 Get the light diffuse color.
 
vec4 OivLightSourceSpecular (int id)
 Get the light specular color.
 
float OivLightSourceConstantAttenuation (int id)
 Get the light constant attenuation value.
 
float OivLightSourceLinearAttenuation (int id)
 Get the light linear attenuation value.
 
float OivLightSourceQuadraticAttenuation (int id)
 Get the light quadratic attenuation value.
 
int OivMaxLightId ()
 
vec4 OivFrontMaterialAmbient ()
 Get front material ambient color.
 
vec4 OivFrontMaterialDiffuse ()
 Get front material diffuse color.
 
vec4 OivFrontMaterialSpecular ()
 Get front material specular color.
 
vec4 OivFrontMaterialEmissive ()
 Get front material emissive color.
 
float OivFrontMaterialShininess ()
 Get front material shininess value.
 
float OivFrontMaterialSpecularFactor ()
 Get front material specular factor value.
 
float OivFrontMaterialRoughness ()
 Get front material roughness value.
 
float OivFrontMaterialMetallic ()
 Get front material metallic value.
 
vec4 OivBackMaterialAmbient ()
 Get back material ambient color.
 
vec4 OivBackMaterialDiffuse ()
 Get back material diffuse color.
 
vec4 OivBackMaterialSpecular ()
 Get back material specular color.
 
vec4 OivBackMaterialEmissive ()
 Get back material emissive color.
 
float OivBackMaterialShininess ()
 Get back material shininess value.
 
float OivBackMaterialSpecularFactor ()
 Get back material specular factor value.
 
float OivBackMaterialRoughness ()
 Get back material roughness value.
 
float OivBackMaterialMetallic ()
 Get back material metallic value.
 
vec4 OivFrontSceneColor ()
 Get sum of emissive component of front material and product between front material ambient and global ambient value.
 
vec4 OivFrontLightProductAmbient (int id)
 Get product of ambient component between back material and id'th light.
 
vec4 OivFrontLightProductDiffuse (int id)
 Get product of diffuse component between back material and id'th light.
 
vec4 OivFrontLightProductSpecular (int id)
 Get product of specular component between back material and id'th light.
 
vec4 OivBackLightProductAmbient (int id)
 Get product of ambient component between back material and id'th light.
 
vec4 OivBackLightProductDiffuse (int id)
 Get product of diffuse component between back material and id'th light.
 
vec4 OivBackLightProductSpecular (int id)
 Get product of specular component between back material and id'th light.
 
bool OivClipPlaneEnabled (int id)
 Ask if clip plane is enabled.
 
vec4 OivClipPlane (int id)
 Get the clip plane coordinates.
 
vec4 OivFogColor ()
 Get the fog color.
 
float OivFogDensity ()
 Get fog density used in exponential fog equations.
 
float OivFogStart ()
 Get the near distance used in the linear fog equation.
 
float OivFogEnd ()
 Get the far distance used in the linear fog equation.
 
float OivFogScale ()
 Get the fog scale derived from start and end parameters : 1.0 / (end - start)
 
int OivFogType ()
 Get the fog type.
 
vec4 OivObjectPlaneS (int i)
 Get the user-defined planes for texture coordinate generation.
 
vec4 OivObjectPlaneT (int i)
 Get the user-defined planes for texture coordinate generation.
 
vec4 OivObjectPlaneR (int i)
 Get the user-defined planes for texture coordinate generation.
 
vec4 OivObjectPlaneQ (int i)
 Get the user-defined planes for texture coordinate generation.
 

Detailed Description

This file contains fonction to acces built-in GLSL uniforms.

Definition in file oivShaderState.h.

Macro Definition Documentation

◆ OIV_LIGHT_TYPE_DIRECTIONAL

#define OIV_LIGHT_TYPE_DIRECTIONAL   3

Definition at line 171 of file oivShaderState.h.

◆ OIV_LIGHT_TYPE_NONE

#define OIV_LIGHT_TYPE_NONE   0

Definition at line 168 of file oivShaderState.h.

◆ OIV_LIGHT_TYPE_POINT

#define OIV_LIGHT_TYPE_POINT   1

Definition at line 169 of file oivShaderState.h.

◆ OIV_LIGHT_TYPE_SPOT

#define OIV_LIGHT_TYPE_SPOT   2

Definition at line 170 of file oivShaderState.h.

◆ OIV_PROJECTION_TYPE_ORTHO

#define OIV_PROJECTION_TYPE_ORTHO   0

Definition at line 118 of file oivShaderState.h.

◆ OIV_PROJECTION_TYPE_PERSPECTIVE

#define OIV_PROJECTION_TYPE_PERSPECTIVE   1

Definition at line 119 of file oivShaderState.h.

Function Documentation

◆ OivBackLightProductAmbient()

vec4 OivBackLightProductAmbient ( int  id)

Get product of ambient component between back material and id'th light.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
product of ambient component between back material and id'th light.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackLightProductDiffuse()

vec4 OivBackLightProductDiffuse ( int  id)

Get product of diffuse component between back material and id'th light.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
product of diffuse component between back material and id'th light.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackLightProductSpecular()

vec4 OivBackLightProductSpecular ( int  id)

Get product of specular component between back material and id'th light.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
product of specular component between back material and id'th light.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialAmbient()

vec4 OivBackMaterialAmbient ( )

Get back material ambient color.

Returns
ambient color for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialDiffuse()

vec4 OivBackMaterialDiffuse ( )

Get back material diffuse color.

Returns
diffuse color for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialEmissive()

vec4 OivBackMaterialEmissive ( )

Get back material emissive color.

Returns
emissive color for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialMetallic()

float OivBackMaterialMetallic ( )

Get back material metallic value.

Returns
metallic value for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialRoughness()

float OivBackMaterialRoughness ( )

Get back material roughness value.

Returns
roughness value for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialShininess()

float OivBackMaterialShininess ( )

Get back material shininess value.

Returns
shininess value for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialSpecular()

vec4 OivBackMaterialSpecular ( )

Get back material specular color.

Returns
specular color for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivBackMaterialSpecularFactor()

float OivBackMaterialSpecularFactor ( )

Get back material specular factor value.

Returns
specular factor value for back material.

Note that this parameter is relevant only if two side lighting is enabled (i.e. OivHasTwoSidedLighting() returns true).

◆ OivClipPlane()

vec4 OivClipPlane ( int  id)

Get the clip plane coordinates.

Parameters
idspecifies which clip plane id to ask, must be between 0 and OivMaxClipPlanes()-1.
Returns
the clip plane .

◆ OivClipPlaneEnabled()

bool OivClipPlaneEnabled ( int  id)

Ask if clip plane is enabled.

Parameters
idspecifies which clip plane id to ask, must be between 0 and OivMaxClipPlanes()-1.
Returns
true if clip plane with a given id is enabled, false otherwise.

◆ OivFogColor()

vec4 OivFogColor ( )

Get the fog color.

Returns
fog color.

◆ OivFogDensity()

float OivFogDensity ( )

Get fog density used in exponential fog equations.

Returns
fog density.

◆ OivFogEnd()

float OivFogEnd ( )

Get the far distance used in the linear fog equation.

Returns
fog end.

◆ OivFogScale()

float OivFogScale ( )

Get the fog scale derived from start and end parameters : 1.0 / (end - start)

Returns
fog scale.

◆ OivFogStart()

float OivFogStart ( )

Get the near distance used in the linear fog equation.

Returns
fog start.

◆ OivFogType()

int OivFogType ( )

Get the fog type.

Returns
fog type (FOG_TYPE_NONE, FOG_TYPE_EXP, FOG_TYPE_EXP2 or FOG_TYPE_LINEAR).

◆ OivFrontLightProductAmbient()

vec4 OivFrontLightProductAmbient ( int  id)

Get product of ambient component between back material and id'th light.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
product of ambient component between back material and id'th light.

◆ OivFrontLightProductDiffuse()

vec4 OivFrontLightProductDiffuse ( int  id)

Get product of diffuse component between back material and id'th light.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
product of diffuse component between back material and id'th light.

◆ OivFrontLightProductSpecular()

vec4 OivFrontLightProductSpecular ( int  id)

Get product of specular component between back material and id'th light.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
product of specular component between back material and id'th light.

◆ OivFrontMaterialAmbient()

vec4 OivFrontMaterialAmbient ( )

Get front material ambient color.

Returns
ambient color for front material.

◆ OivFrontMaterialDiffuse()

vec4 OivFrontMaterialDiffuse ( )

Get front material diffuse color.

Returns
diffuse color for front material.

◆ OivFrontMaterialEmissive()

vec4 OivFrontMaterialEmissive ( )

Get front material emissive color.

Returns
emissive color for front material.

◆ OivFrontMaterialMetallic()

float OivFrontMaterialMetallic ( )

Get front material metallic value.

Returns
metallic value for front material.

◆ OivFrontMaterialRoughness()

float OivFrontMaterialRoughness ( )

Get front material roughness value.

Returns
roughness value for front material.

◆ OivFrontMaterialShininess()

float OivFrontMaterialShininess ( )

Get front material shininess value.

Returns
shininess value for front material.

◆ OivFrontMaterialSpecular()

vec4 OivFrontMaterialSpecular ( )

Get front material specular color.

Returns
specular color for front material.

◆ OivFrontMaterialSpecularFactor()

float OivFrontMaterialSpecularFactor ( )

Get front material specular factor value.

Returns
specular factor value for front material.

◆ OivFrontSceneColor()

vec4 OivFrontSceneColor ( )

Get sum of emissive component of front material and product between front material ambient and global ambient value.

Returns
sum of emissive component of front material and product between front material ambient and global ambient value.

◆ OivGlobalAmbient()

vec4 OivGlobalAmbient ( )

Gets the global ambient color value.

Returns
The global ambient color value

◆ OivHasColorMaterial()

bool OivHasColorMaterial ( )

Ask if color material is enabled.

Returns
true if color material is active, false otherwise

◆ OivHasLighting()

bool OivHasLighting ( )

Ask if lighting is enabled.

Returns
true if lighting is enabled, false otherwise.

◆ OivHasPerPixelLighting()

bool OivHasPerPixelLighting ( )

Ask if per-pixel lighting is enabled.

Returns
true if per-pixel lighting is enabled, false otherwise

◆ OivHasTwoSidedLighting()

bool OivHasTwoSidedLighting ( )

Ask if two-sided lighting is enabled.

Returns
true if two-sided lighting is enabled, false otherwise

◆ OivLightSourceAmbient()

vec4 OivLightSourceAmbient ( int  id)

Get the light ambient color.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light ambient color for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceConstantAttenuation()

float OivLightSourceConstantAttenuation ( int  id)

Get the light constant attenuation value.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light constant attenuation value for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceDiffuse()

vec4 OivLightSourceDiffuse ( int  id)

Get the light diffuse color.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light diffuse color for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceEnabled()

bool OivLightSourceEnabled ( int  id)

Ask if the light is enabled.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
true if light with a given id is enabled, false otherwise.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceLinearAttenuation()

float OivLightSourceLinearAttenuation ( int  id)

Get the light linear attenuation value.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light linear attenuation value for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourcePosition()

vec4 OivLightSourcePosition ( int  id)

Get the light position.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light position for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceQuadraticAttenuation()

float OivLightSourceQuadraticAttenuation ( int  id)

Get the light quadratic attenuation value.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light quadratic attenuation value for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceSpecular()

vec4 OivLightSourceSpecular ( int  id)

Get the light specular color.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light specular color for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceSpotCosCutoff()

float OivLightSourceSpotCosCutoff ( int  id)

Get the light spot cutoff cosine.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light spot cutoff cosine for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceSpotCutoff()

float OivLightSourceSpotCutoff ( int  id)

Get the light spot cutoff.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light spot cutoff for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceSpotDirection()

vec3 OivLightSourceSpotDirection ( int  id)

Get the light spot direction.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light spot direction for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceSpotExponent()

float OivLightSourceSpotExponent ( int  id)

Get the light spot exponent.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the light spot exponent for a given light id.

Note that this parameter is relevant only if lighting is enabled (i.e. OivHasLighting() returns true).

◆ OivLightSourceType()

int OivLightSourceType ( int  id)

Get the type of the light.

Parameters
idspecifies which light id to ask, must be between 0 and OivMaxLights()-1.
Returns
the type of the light (OIV_LIGHT_TYPE_NONE, OIV_LIGHT_TYPE_POINT, OIV_LIGHT_TYPE_SPOT or OIV_LIGHT_TYPE_DIRECTIONAL).

◆ OivMaxClipPlanes()

int OivMaxClipPlanes ( )

Get the maximum number of clipping planes sets by Open Inventor.

◆ OivMaxLightId()

int OivMaxLightId ( )

◆ OivMaxLights()

int OivMaxLights ( )

Get the maximum number of lights sets by Open Inventor.

◆ OivMaxTextureCoordinates()

int OivMaxTextureCoordinates ( )

Get the maximum number of texture coordinates sets by Open Inventor.

◆ OivMaxTextureUnits()

int OivMaxTextureUnits ( )

Get the maximum number of texture units sets by Open Inventor.

◆ OivModelMatrix()

mat4 OivModelMatrix ( )

Get transformation of the model (M).

Returns
the model matrix.

◆ OivModelMatrixInverse()

mat4 OivModelMatrixInverse ( )

Get inverse transformation of the model (M^{-1}).

Returns
the inverse of the model matrix.

◆ OivModelViewMatrix()

mat4 OivModelViewMatrix ( )

Get the combination of model and view transformations (MV), i.e., MV = V * M.

Returns
the model-view matrix.

◆ OivModelViewMatrixInverse()

mat4 OivModelViewMatrixInverse ( )

Get the inverse of the model-view matrix,.

Returns
the inverse of the model-view matrix.

◆ OivModelViewProjectionMatrix()

mat4 OivModelViewProjectionMatrix ( )

Get the combination of projection and model-view matrices (MVP), i.e., MVP = P * V * M.

Returns
the model-view-projection matrix

◆ OivNormalMatrix()

mat3 OivNormalMatrix ( )

Get the normal matrix (N), i.e., N = tr(MV^{-1}).

Returns
the normal matrix.

◆ OivObjectPlaneQ()

vec4 OivObjectPlaneQ ( int  i)

Get the user-defined planes for texture coordinate generation.

Returns
user-defined plane

◆ OivObjectPlaneR()

vec4 OivObjectPlaneR ( int  i)

Get the user-defined planes for texture coordinate generation.

Returns
user-defined plane

◆ OivObjectPlaneS()

vec4 OivObjectPlaneS ( int  i)

Get the user-defined planes for texture coordinate generation.

Returns
user-defined plane

◆ OivObjectPlaneT()

vec4 OivObjectPlaneT ( int  i)

Get the user-defined planes for texture coordinate generation.

Returns
user-defined plane

◆ OivProjectionMatrix()

mat4 OivProjectionMatrix ( )

Get the projection matrix (P).

Returns
the projection matrix.

◆ OivProjectionMatrixInverse()

mat4 OivProjectionMatrixInverse ( )

Get the inverse of the projection matrix (P^{-1}).

Returns
the inverse projection matrix.

◆ OivTextureMatrix()

mat4 OivTextureMatrix ( int  unit)

Get texture matrices.

Parameters
unitspecifies which texture unit between 0 and OivMaxTextureUnit()-1.
Returns
the texture matrix for a given unit.

◆ OivViewMatrix()

mat4 OivViewMatrix ( )

Get transformation of the view (V).

Returns
the view matrix.

◆ OivViewMatrixInverse()

mat4 OivViewMatrixInverse ( )

Get inverse transformation of the view (V^{-1}).

Returns
the inverse of the view matrix.

◆ OivViewportSize()

vec2 OivViewportSize ( )

Get the size of the viewport.

Returns
width and height of the viewport packed in vec2.

◆ OivViewProjectionType()

int OivViewProjectionType ( )

Get the projection type of the camera (OIV_PROJECTION_TYPE_ORTHO or OIV_PROJECTION_TYPE_PERSPECTIVE)

◆ OivViewVolumeSize()

vec2 OivViewVolumeSize ( )

Get the near/far view volume of the camera.