ftp.nice.ch/pub/next/developer/objc/api/intuitiv3d_API.s.tar.gz#/i3dApi/Documentation/Classes/CX3DShader.rtf

This is CX3DShader.rtf in view mode; [Download] [Up]

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






CX3DShader 






Inherits From:	ObjectView : View  : Responder : Object

Declared In:	i3d/CX3DShader.h





Class Description

CX3DShader is the object representation of Renderman shaders inside intuitiv'3d. Shaders are written using the Shading Language and compiled using the shaders application.  A CX3DShader contains the name of the Renderman Shader it stands for and the parameters used when rendering. A shader instance is inspected by the Shader Panel of intuitiv'3d. CX3DShader is also an abstract super-class allowing you to provide some pre-rendering for shaders and special inspectors for one or more parameter of the shader.

Instance Variables

  char 	className [CLASS_NAME_SIZE];
  CXShaderType   	type;
  CXRenderType   	renderType;
  int            	argCount;
  CXArg          	*arg;
  BOOL 	canRender;
  float 	scale[3];
  float 	dispBound;
  

className 	The className of a shader is the name of the Renderman shader used when rendering.

 type 	The type of shader. (Surface , displacement, light, ... )

renderType	How the shader should be rendered. Today, this is important for light shaders since more than one Renderman function can be used.

argCount	Number of arguments for the shader.

arg	Argument array.

canRender	This boolean value is equal to YES if the rendering is possible and NO if an information is missing.

scale	The scale used just before rendering the shader.

dispBound	The displacement bound used just before rendering a shader. Only displacement shaders are using displacement bound.
Method Types

Initializing,  freeing and copying
	+ (ExportedVariable*) exportedVariable
	- init
	- initWithShaderClassName:
	- copy
	- initParametersFromShader: anObject
	- free
	

Rendering
	- preRender:
	- postRender:
	- render

Attributes
	- setOwner:
	- owner
	- setDisplacementBound:
	- displacementBound
	- setScaleX:Y:Z:
	- getScaleX:Y:Z:
	- setShaderRenderType:
	- setDefaultShaderRenderType
	- shaderRenderType
	- argCount
	- argArray
	
Information about the shader
	- renderTypeCompatible:
	- className
	- type

Inspector
	- inspectorClass

Archiving
	- read:
	- write:
	- awake


Miscellaneous
	- calcSum
	


Class Methods

exportedVariable
	+ (ExportedVariable*) exportedVariable
This method returns a description of instance variable that must be saved or loaded.
 
See also: ExportedVariable.rtf in the Functions folder. 



Instance Methods
argCount
	- (unsigned int) argCount
This methods returns the number of argument that the receiver is using.

See also: - argArray, the file CX3DShader.rtf in the TypesAndConstants folder.


argArray
	- (CXArg*) argArray
This method returns the arguments currently used by the receiver. You can discover the number of argument by using the - argCount method. 

See also: - argCount, the file CX3DShader.rtf in the TypesAndConstants folder.


awake
	- awake
This method is called just after unarchiving an object. If you want to initialize some unsaved instance variable, you have to overload this method. Always call [super awake] in your implementation. 

See also: - read , - write 


calcSum
	- (unsigned int) calcSum
This method is used by intuitiv'3d to discover if a scene has changed. The default implementation of this method calculates the sum of all instance variable. If your new subclass has some id instance variables, you should overload this method to count that instance variable contents.


copy
	- copy
Duplicates the receiver. Return the new instance. You should overload this method and duplicate your own instance variable.  Your implementation of - copy should call [super copy].



className
	- (const char*) className
This method returns the class (the Renderman shader's name) used by the receiver.

See also: - initWithShaderClassName:



displacementBound
	- (float) displacementBound
This method returns the value of the displacementBound instance variable.

See also: - setDisplacementBound 



free
	- free
Free the memory used by the receiver.  You should overload this method in order to free the memory used by your own instance variables.




getScaleX:Y:Z
	- getScaleX:(float*) x Y:(float*) y Z:(float*) z
This function fill the x,y and z pointer with the value of the receiver's scale instance variable.  



init
	- init
Initializes and returns the receiver, a new CX3Shader instance. The subclass should overload the - init method to initialize its new instance variables. Subclass's version of - init should began with a [super init] call. 

See also: - initWithShaderClassName: 



initParametersFromShader: 
	- initParametersFromShader: anObject
This method initialize the receiver's argument array with the values used by anObject. anObject and the receiver should use the same Renderman shader (className instance variables should be the same).



initWithShaderClassName:
	- initWithShaderClassName:(const char*)  aName
This method call the - init method and then initializes the receiver with all information needed to use the shader aName. The shader is useable after this call. Shader's parameters are initialized with there default values.
Returns the receiver. 

See also: - init , - className



inspectorClass
	- inspectorClass
This method should return the inspector used by the receiver. You must overload this method if you want to write a better inspector for your new shader. The default implementation returns [CX3DGenericShaderInspector class].



owner
	- owner
This method returns the owner of the receiver.

See also: - setOwner 



postRender
	- postRender: aDisplayer
This method is called by the rendering pipeline to allow the receiver to free any memory allocated by the preRender: method or to erase any file created by the preRender: method. The default implementation of postRender: does nothing.

See also: The file Concepts/Rendering.rtf , - preRender, - render



preRender
	- preRender: aDisplayer
This method is called by the rendering pipeline to allow the receiver to perform its pre-rendering operations. The default implementation of - preRender does nothing. aDisplayer is the Displayer instance that manage the rendering.

See also:The file Concepts/Rendering.rtf, - postRender: , - render


read
	- read:(NXTypedStream*) stream
This method is used by the archiving system. The default implementation of this method call the evReadVariableForObject() function. You have to overload this method only if your instance variables cannot be managed by the exported variable features. 

See also: ExportedVariable.rtf in the Functions folder., - write, - awake 


render
	- render
The render method is called by the rendering pipeline to ask the receiver to set in the Renderman graphic context the shader className with parameters in the arg instance variable. The default version of this method is able to render any shader. You have to overload this method if you want to use some pre-rendering. 

See also: - preRender: , -postRender


renderTypeCompatible:
	- (BOOL) renderTypeCompatible:(CXRenderType) renderType
This method allows you to discover if a render type is useable by the receiver. This method is used by the shader itself and you don't have to use this method directly.


setDefaultShaderRenderType
	- setDefaultShaderRenderType
This method sets the  default Renderman function that can be used according to the receiver's type to render the shader. The renderType instance variable defines which Renderman function will be used in order to render the shader.  The following table shows how this initialization is performed.

	Type	Function
	CXSTSurface 	CXRTSurface
	CXSTLight	CXRTAeraLight	CXSTDisplacement	CXRTDisplacement
	CXSTVolume	CXRTVolume
	Other type	CXRTUndefined	

See also: - setRenderType:, - shaderRenderType , the file CX3DShader.rtf in the TypesAndConstants folder.



setDisplacementBound:
	- setDisplacementBound:(float) aValue
This method affects the contents of the displacementBound instance variable. This value is given when rendering to the function RiAttribute with the "bound" parameter. This is useful for displacement mapping.

See also: - displacementBound, RiAttribute


setOwner:
	- setOwner: anObject
This method sets the shader owner. The shader is applied onto its owner.A nil owner means no owner.

See also: - owner 


setScaleX:Y:Z:	- setScaleX:(float) x Y: (float) y Z: (float) z
This method affects the contents of the scale instance variable. The scale instance variable is applied to the graphic context just before rendering the shader.

See also: - getScaleX:Y:Z 


setShaderRenderType:
	- setShaderRenderType:(CXRenderType) renderType
This methods sets the value of the renderType instance variable. The renderType instance variable defines which Renderman function will be used in order to render the shader. Returns the receiver.

See also: - setDefaultShaderRenderType, - shaderRenderType,the file CX3DShader.rtf in the TypesAndConstants folder.

shaderRenderType
	- (CXRenderType) shaderRenderType
This method returns the receiver's shader render type.

See also: - setDefaultShaderRenderType, - setShaderRenderType,the file CX3DShader.rtf in the TypesAndConstants folder. 


type
	- (CXShaderType) type
This method returns the type of the receiver. The type of a CX3DShader is defined by the type of its class. This variable is affected only during the call - initWithShaderClassName:.

See also: the file CX3DShader.rtf in the TypesAndConstants folder. 


write
	- write:(NXTypedStream*) stream
This method is used by the archiving system. The default implementation of this method calls the evWriteVariableForObject() function. You have to overload this method only if your instance variables cannot be managed by the exported variable features. 

See also: ExportedVariable.rtf in the Functions folder., - read, - awake 





These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.