intuitiv'3d API documentation Copyright ã1993 by Cub'x SystÜmes. All Rights Reserved.

CX3DEnvmapShader 

Inherits From:	CX3DShader : ObjectView : View : Responder : Object

Declared In:	i3d/CX3DEnvmapShader.h

Class Description

A CX3DEnvmap shader is an abstract superclass that implements the pre-rendering necessary to make an environment map for one of shader's parameters. If you write with the shading language a new shader that uses environment mapping, you just have to make a subclass of CX3DEnvmapShader and overload the method - init and - (CXArg*) environMapArg

Instance Variables

 char     *envMapBuff;
 BOOL shouldUseEnvMap;
 float      detailLevel;

envMapBuff 	This variable is not saved and contains the disk path of the temporary file used to store the environment map itself.

shouldUseEnvMap	This boolean value describes if the user wants the environment map features or not.

detailLevel	This float number is between 0 and 100 and defines the precision of the pre-rendering process.

Method Types

Initializing, defining,  freeing and copying
 
	+ exportedVariable
	- init
	- initParametersFromShader: 
	- free
	- copy
	- shouldUseTextcoord

Rendering 
	- preRender: 
	- postRender: 
	
Attributes and inspector
	- setUseEnvmap:
	- shouldUseEnvMap
	- setDetailLevel:
	- detailLevel
	- inspectorClass

Facilities
	- convertTranslation:forObject: 

Archiving	
	- awake

Method implemented by the subclass
	- environMapArg

Class Methods

exportedVariable
					 + (ExportedVariable*) exportedVariable

This method returns a description of instance variable that must be saved.

See also:  ExportedVariable.rtf in the Functions folder. 

Instance Methods

awake
	      - awake

Used during unarchiving to initialize static variables for the Cell class.  Returns self.

convertTranslation:forObject
	- convertTranslation:(float*) p forObject: anObject

This method converts the point p inside anObject coordinate system into the world coordinate system. 

copy
	- copy
Duplicates the receiver. Return the new instance.

detailLevel
	- (float) detailLevel
Returns the current value of the detailLevel instance variable. The detail level controls the size and the shading rate of the environment map. detailLevel value is a number between 0 and 100 %. This method is used by the CX3DEnvmapShaderInspector instance.

See also:  - setDetailLevel:, CX3DEnvmapShaderInspector class.

environMapArg
	- (CXArg*) environMapArg

This is the subclass responsibility to implement this method. It should returns the address of the CXArg that needs the environment map. The arg instance variable contains all shader arguments and is inherited from CX3DShader.
For example, if the third shader parameter needs the environ map, the environMapArg method will be:

	- (CXArg*) environMapArg
	{
	   return &arg[2]; 
  }

See also: CX3DShader class documentation, Shiny.m in the Examples/AdvancedObject directory.

free
	- free
Free the memory used by the receiver. 

init
	- init
Initializes and returns the receiver, a new CX3DEnvmapShader instance. It is the subclass responsibility to call the method initWithShaderClassName: in the init method with the shader used as argument. Since initWithShaderClassName: call init, you should make a test with an instance variable to stop the recursive call.

See also: - initWithShaderClassName: CX3DShader class documentation  Shiny.m in the Examples/AdvancedObject directory

initParametersFromShader: 
	- initParametersFromShader: anObject
This method initialize shader's parameters (the arg array) with values of anObject. anObject should be an instance of the same class than the receiver. 

inspectorClass 
	- inspectorClass
This method returns the class id that should be used as the class's inspector of the shader. This method currently returns CX3DEnvmapShaderInspector.

See also: CX3DEnvmapShaderInspector class.

postRender:
	- postRender: aDisplayer
This method is called by the rendering pipeline to allow the object to free any memory allocated by the preRender: method or to erase any file created by the preRender: method. The postRender:'s implementation of CX3DEnvmapShader just erases the environment map file.

See also:The file Concepts/Rendering.rtf

preRender:
	- preRender: aDisplayer
This method is called by the rendering pipeline to allow the object to perform its pre-rendering operations. The current implementation of preRender for CX3DEnvmapShader is to calculate the environment map if need.

See also: The file Concepts/Rendering.rtf

setDetailLevel:
	- setDetailLevel: (float) aFloat 
This method set the value of the detailLevel instance variable. This method is called by the CX3DEnvmapShaderInspector instance. 

See also: CX3DEnvmapShaderInspector class, - detailLevel

setUseEnvMap:
	- setUseEnvMap:(BOOL) aFlag 
This method set whether the shader will calculate an environment map shader or not. This method just sets the shouldUseEnvMap instance variable. This method is called by the CX3DEnvmapShaderInspector instance.

See also: CX3DEnvmapShaderInspector class, - (BOOL) useEnvMap

shouldUseEnvMap
	- (BOOL) shouldUseEnvMap 
This method returns the value of the shouldUseEnvMap instance variable. This method is called by the CX3DEnvmapShaderInspector instance.

See also: CX3DEnvmapShaderInspector class, - setUseEnvMap

shouldUseTextCoord
	- (BOOL) shouldUseTextCoord 
This method returns allways YES. This method only exists for backward compatibility.

See also: CX3DShader class