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

CX3DLightSource 

Inherits From:	CX3DObject : ObjectView : View : Responder : Object

Declared In:	i3d/CX3DLightSource.h

Class Description

CX3DLightSource is an abstract superclass that defines and implements the functionalities required by a light object inside intuitiv'3d. You want to make a subclass of CX3DLightSource when you have written a new light shader and you need a special inspector for it or a preRendering process. If you just want to experiment a new light shader, you can use the generic light object in the default light section of intuitv'3d. Although Renderman thinks of a a light as a shader, intuitiv'3d considers a light like a 3d object. This 3d object have a special method named illuminate that perform an illumination. The render method works only with quick-renderman and is used to display a light representation. 

Instance Variables

BOOL isConstLight
BOOL showQuickRepresentation
BOOL haveBeenPlaced
RtPoint from
RtPoint to
RtPoint oldTo
BOOL moveTo
NXColor color

isConstLight	This variable describes if this light is a toplevel fixed light or a local light. Local light are for futur use only. For now this instance variable is always equal to YES.	

showQuickRepresentation	This variable describes if this light should display its representation all the time.

haveBeenPlaced	This variable describes if this light have already been dropped into a display. If this variable is equal to NO, the initSelfFromCamera method is called when the light is dropped.

from	This variable contains the "from" location of the light or its single location.

to	This variable contains the "to" location of the light.

oldTo	Private.

moveTo	If this variable is equal to YES, orthographic views moves the to point, otherwise, the from point is moved.

color	This variable contains the color of the light.

Method Types

Initializing, freeing and copying
	+ exportedVariable
	- init
	- initSelfFromCamera
	- copy
	- free

Rendering
	- render
	- illuminate
	- preRender:
	- postRender: 
Light position
	- setFromX:Y:Z:
	- getFromX:Y:Z:
	- setToX:Y:Z:
	- getToX:Y:Z:
Light attributes

	- setHaveBeenPlaced:
	- haveBeenPlaced
	- setConstLight:
	- isConstLight
	- showQuickRepresentation:
	- showQuickRepresentation
	- setLightOn:
	- isOn
	- setMoveTo:
	- moveTo
	- setColor:
	- color

Methods as a subclass of CX3DObject

	- isALight
	- willAcceptShader: 

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

color
	- (NXColor) color
This method returns the value of the color instance variable. 

See also: - setColor:

copy
	- copy
Duplicates the receiver. Returns the new instance. You should overload this method and duplicate your own instance variables. 

See also: The example SlideProjector.m in Examples/AdvancedObject

free
	- free
Free the memory used by the receiver.  

getFromX:Y:Z:
	- getFromX:(float*) x Y:(float*) y Z:(float*) z
This method is called when you move a light using the mouse. Copy the contents of the from instance variable to the contents of x,y and z.

getToX:Y:Z:
	- getToX:(float*) x Y:(float*) y Z:(float*) z
This method is called when you move a light using the mouse. Copy the contents of the to instance variable to the contents of x,y and z.

haveBeenPlaced
	- (BOOL) haveBeenPlaced
Returns the value of the haveBeenPlaced instance variable.

See also: - setHaveBeenPlaced, - initSelfFromCamera: 

illuminate
	- illuminate
This method is called during the render process to ask the light object to illuminate the scene. This method generally call RiLightSource and began by a test if ( [self isOn] ).  Remember that since all lights are global lights in the current version of intuitiv'3d, the illuminate is called before the WorldBegin function call. Return self.

See also: The example SlideProjector.m in Examples/AdvancedObject 

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

See also:  The example SlideProjector.m in Examples/AdvancedObject

initSelfFromCamera
	- initSelfFromCamera: aDisplay
This method is called when a light is dropped into a Displayer and its instance variable haveBeenPlaced is equal to NO. aDisplay is a Displayer instance. Since the Displayer class is a subclass of N3DCamera, you can use the - getEyeAt:toward:roll: method to discover the current camera position. The CX3DLightSource's implementation of 
initSelfFromCamera does nothing. 

See also: - getEyeAt:toward:roll (N3DCamera)  The example SlideProjector.m in Examples/AdvancedObject

isALight
	- (BOOL) isALight
This method always returns YES. 

See also: - isALight (CX3DObject)

isConstLight
	- (BOOL) isConstLight
This method returns the value of the constLight instance variable.

See also: - setConstLight:

isOn
	- (BOOL) isOn
Returns YES if the light is on, NO otherwise.

See also: setLightOn:

moveTo
	- (BOOL) moveTo
Returns the value of the moveTo instance variable.

See also: - setMoveTo:

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 CX3DLightSource does nothing.

See also: The file Concepts/Rendering.rtf, The example SlideProjector.m in Examples/AdvancedObject

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 CX3DLightSource does nothing.  

See also: The file Concepts/Rendering.rtf, The example SlideProjector.m in Examples/AdvancedObject

render
	- render
For a light object, the render method is invoked only when using quick-renderman. This method should use Renderman functions to display a light representation. The distant light uses an arrow, the point light a little sphere and so on.  As all - render method, this method should begin by a if ( [super render] ) call.   Return self.

See also: - render (CX3DObject)  The example SlideProjector.m in Examples/AdvancedObject

setColor
	- setColor:(NXColor) aColor
This method affects the value of the color instance variable. It is your subclass responsibility to use this variable in the - illuminate and the - render method.

See also: color

setConstLight:
	- setConstLight:(BOOL) aFlag
This method affects the value of the constLight instance variable. The current version of intuitiv'3d doesn't use this method.

See also: - isConstLight

setFromX:Y:Z:
	- setFromX:(float) x Y:(float) y Z:(float) z
This method is called when you move a light using the mouse. x,y,z values are affected to the instance variable from.

setHaveBeenPlaced:
	- setHaveBeenPlaced:(BOOL) aFlag
This method affects the value of the haveBeenPlaced instance variable. intuitiv'3d engine call setHaveBeenPlaced: with YES as argument when the method - initSelfFromCamera has been successfully called.

See also: - initSelfFromCamera, - haveBeenPlaced

setLightOn:
	- setLightOn:(BOOL) aFlag
This method uses the visibility flags of CX3DObject to set the light on or off. 

See also: - isOn

setMoveTo
	- setMoveTo:(BOOL) aFlag
This method affects the value of the moveTo instance variable. If the moveTo instance variable is equal to YES, the to point is moved when moving a light with the mouse. Otherwise, the from point is moved.

See also: - moveTo

setToX:Y:Z:
	- setToX:(float) x Y:(float) y Z:(float) z
This method is called when you move a light using the mouse. x,y,z values are affected to the instance variable to.

showQuickRepresentation
	- (BOOL) showQuickRepresentation
Returns the value of the showQuickRepresentation instance variable.

See also: - showQuickRepresentation: 

showQuickRepresentation:
	- showQuickRepresentation:(BOOL) aFlag
This method affects the value of the showQuickRepresentation instance variable.When this variable is equal to YES, the - render method of the light is called all the time when using quick-renderman. Otherwise the - render method is called only when the lightset is selected inside the world browser.

See also: - showQuickRepresentation 

willAcceptShader
	- (BOOL) willAcceptShader: aShader
Since a default light doesn't use a shader, this method always returns NO.

See also: - willAcceptShader: (CX3DObject)