Scheme Extensions Aa thru Lz

 

 

Technical Article


Scheme is a public domain programming language, based on the LISP language, that uses an interpreter to run commands. ACIS provides extensions (written in C++) to the native Scheme language that can be used by an application to interact with ACIS through its Scheme Interpreter. The C++ source files for ACIS Scheme extensions are provided with the product. Spatial's Scheme based demonstration application, Scheme ACIS Interface Driver Extension (Scheme AIDE), also uses these Scheme extensions and the Scheme Interpreter.

color:rgb

Action
Creates a red-green-blue color object.

Filename
scm/scmext/rnd/rgb_scm.cpp

APIs
None

Syntax
(color:rgb red green blue)

Arg Types
red real
green real
blue real

Returns
color

Description
Specify red, green, and blue color components with normalized real numbers, ranging from 0 to 1.

Arguments
           red, green and brown specify the color.

; color:rgb
; Create a blue color object by specifying
; the red, green, and blue values.
(define color (color:rgb 0 0 1))
;; color

[Top]


color:rgb?

Action
Determines if a Scheme object is a color.

Filename
scm/scmext/rnd/rgb_scm.cpp

APIs
None

Syntax
(color:rgb? object)

Arg Types
object scheme-object

Returns
boolean

Description
This extension returns #t if the object is a color; otherwise, it returns #f.

Arguments
object specifies the scheme-object that has to be queried for a color.
; color:rgb?
; Create a blue color object by specifying
; the red, green, and blue values.
(define color (color:rgb 0 0 1))
;; color
(color:rgb? color)
;; #t
; Determine if the object is a color.
(color:rgb? (env:default-color))
;; #t

[Top]


entity:material

Action
Gets the material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_get_material

Syntax
(entity:material entity)

Arg Types
entity entity

Returns
material

Description
This extension returns the material (if any) associated with the entity; otherwise it returns #f.

Arguments
entity specifies the entity to be queried.
; entity:material
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 5 30 0) 8))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Get the material assigned to the cylinder.
(define material (entity:material cyl1))
;; material

[Top]


entity:material-color

Action
Gets the color of the material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_get_material_color

Syntax
(entity:material-color entity)

Arg Types
entity entity

Returns
color

Errors
Returns boolean #f if the material or material-color cannot be found.

Description
This extension returns the material color (if any) associated with the entity.

Arguments
entity is the entity being queried.
; entity:material-color
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 30 30 0) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Set the color of the material.
(entity:set-material-color cyl1
    (color:rgb 1 1 1))
;; ()
; Get the color of the material.
(entity:material-color cyl1)
;; #[color 1 1 1]

[Top]


entity:material-reflection

Action
Gets the reflection properties of the material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_get_material_reflection

Syntax
(entity:material-reflection entity)

Arg Types
entity entity

Returns
(real, real, real, real)

Errors
Returns boolean #f if the material or material-reflection cannot be found.

Description
This extension returns the material reflection properties (if any) associated with the entity. The first three real values returned are the ambient reflection, diffuse reflection, and specular reflection, respectively, which range from 0 to 1. The last real value returned is the exponent.

Arguments
entity specifies an entity to be queried.
; entity:material-reflection
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 30 30 0) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Get the default material reflection properties.
(entity:material-reflection cyl1)
;; (1 0.75 0.5 10)

[Top]


entity:material-texture

Action
Gets the texture file name in a material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_get_material_texture

Syntax
(entity:material-texture entity)

Arg Types
entity entity

Returns
string

Errors
Returns boolean #f if the material or material-texture cannot be found.

Description
This extension sets the texture file name in a material associated with the entity. The return value string specifies the file name of the texture attached to the material.

Arguments
entity specifies an entity to which the material is attached.
; entity:material-texture
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 10 0 30) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Set the material's texture.
(entity:set-material-texture cyl1 "brick.bmp")
; Get the material's new texture.
;; ()
(entity:material-texture cyl1)
;; "brick.bmp"

[Top]


entity:material-transparency

Action
Gets the transparency property in the material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_get_material_transp

Syntax
(entity:material-transparency entity)

Arg Types
entity entity

Returns
real

Errors
Returns the string "entity:material-transparency: operation unsuccessful".

Description
This extension gets the transparency property (if any) in the material associated with a geometric entity. The return value real specifies the transparency factor, which ranges from 0 (transparent) to 1 (opaque).

Arguments
entity specifies an entity to query.
; entity:material-transparency
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 30 5 15) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Set the transparency property of the material.
(entity:set-material-transparency cyl1 0.8)
;; ()
; Get the material's transparency.
(entity:material-transparency cyl1)
;; 0.8

[Top]


entity:render-sides

Action
Gets the sidedness of an entity for rendering purposes.

Filename
scm/scmext/rnd/avh_scm.cpp

APIs
api_rh_get_sidedness

Syntax
(entity:render-sides entity)

Arg Types
entity entity

Returns
integer

Description
This extension returns an integer representing entity sidedness: 0 for undefined sidedness, 1 for single-sided, and 2 for double-sided. By default, a newly created entity has undefined render sidedness.

Arguments
entity specifies an entity to query.
; entity:render-sides
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 8 8 0) 20))
;; cyl1
; Set the sidedness for the cylinder.
(entity:set-render-sides cyl1 2)
;; ()
; Get the sidedness of the cylinder.
(entity:render-sides cyl1)
;; 2

[Top]


entity:set-material

Action
Sets the material attribute of an entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_set_material

Syntax
(entity:set-material entity-list material)

Arg Types
entity-list entity | (entity ...)
material material | #f

Returns
unspecified
Arguments
entity-list specifies an entity or entity list to which the material is to be attached.

material specifies the type of material entity to attach to the entity. If the argument material is #f, then the material attribute is removed from the entity or entity list.
; entity:set-material
; Create a material.
(define matter1 (material))
;; matter1
; Create a solid block.
(define block1
    (solid:block (position 0 0 0)
    (position 15 10 5)))
;; block1
; Assign the material to the block.
(entity:set-material block1 matter1)
;; ()
; Remove the material from the block.
(entity:set-material block1 #f)
;; ()

[Top]


entity:set-material-color

Action
Sets the color of the material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_set_material_color

Syntax
(entity:set-material-color entity rgb-color)

Arg Types
entity entity
rgb-color color

Returns
unspecified

Description
This extension sets the material color (if any) to be associated with the entity. This changes the material's color type to "plain". It does not affect its displacement, reflection, or transparency types or properties.

When a new "plain" color type material is created, the default reflection type is "phong". It has the following properties:

"ambient factor" 1
"diffuse factor" 0.75
"specular factor" 0.5
"exponent" 10
"specular color" #[color 1 1 1]

A high "ambient factor" causes the image to appear bright white in views regardless of the color that has been set. To reveal the color, reset the reflection properties to less extreme values.

Arguments
entity is the entity or entity list for which the color is set.

rgb-color is the color to set.
; entity:set-material-color
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 30 10 3) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Get the default type values.
(material:color-type matter1)
;; "plain"
; Get the default color values.
(material:color-props matter1)
;; (("color" . #[color 1 1 1]))
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Set the color of the material.
(entity:set-material-color cyl1
    (color:rgb 1 1 0))
;; ()

[Top]


entity:set-material-reflection

Action
Sets the reflection properties in the material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_set_material_reflection

Syntax
(entity:set-material-reflection entity
    ambient-ref diffuse-ref specular-ref exponent)

Arg Types
entity entity
ambient-ref real
diffuse-ref real
specular-ref real
exponent real

Returns
unspecified

Description
Sets the reflection properties in the material associated with a geometric entity. This extension sets the material color (if any) to be associated with the entity. This changes the material's color type to "plain". It does not affect its displacement, reflection, or transparency types or properties. The argument rgb_color is the color to set.

When a new "plain" color type material is created, the default reflection type is "phong". It has the following properties:

"ambient factor" 1
"diffuse factor" 0.75
"specular factor" 0.5
"exponent" 10
"specular color" #[color 1 1 1]

A high "ambient factor" causes the image to appear bright white in views regardless of the color that has been set. To reveal the color, reset the reflection properties to less extreme values.

Arguments
entity specifies an entity to which the material is to be attached.

ambient-ref specifies the ambient reflection. The value ranges from 0 to 1.

diffuse-ref specifies the diffuse reflection. The value ranges from 0 to 1.

specular-ref specifies the specular reflection. The value ranges from 0 to 1.

exponent specifies the exponent.
; entity:set-material-reflection
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 30 30 0) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Get the default material properties.
(material:reflection-props matter1)
;; (("ambient factor" . 1) ("diffuse factor" . 0.75)
;; ("specular factor" . 0.5) ("exponent" . 10)
;; ("specular color" . #[color 1 1 1]))
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Set the reflection of the material.
(entity:set-material-reflection cyl1
    0.4 0.6 0.2 10)
;; ()

[Top]


entity:set-material-texture

Action
Sets the texture file name in a material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_set_material_texture

Syntax
(entity:set-material-texture entity filename)

Arg Types
entity entity
filename string

Returns
material

Description
This extension sets the texture file name in a material accosted with the entity. If no named file is found, it returns #f. The color type is set to "wrapped image" and sets its "file name" property to the filename string.

Arguments
entity specifies an entity to which the material is attached.

filename specifies the file name of the texture to be attached.
; entity:set-material-texture
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 30 30 0) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Set the texture of the material.
(entity:set-material-texture cyl1 "brick.bmp")
;; ()

[Top]


entity:set-material-transparency

Action
Sets the transparency property in the material associated with a geometric entity.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_set_material_transp

Syntax
(entity:set-material-transparency entity transparency-factor)

Arg Types
entity entity
transparency-factor real

Returns
unspecified

Description
This extension sets the transparency property in the material associated with a geometric entity.

Arguments
entity specifies an entity to which the material is to be attached.

transparency-factor specifies the transparency factor, which ranges from 0 (transparent) to 1 (opaque).
; entity:set-material-transparency
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 30 5 20) 20))
;; cyl1
; Determine if the cylinder has a material.
(entity:material cyl1)
;; #f
; Create a material.
(define matter1 (material))
;; matter1
; Set the material.
(entity:set-material cyl1 matter1)
;; ()
; Set the transparency of the material.
(entity:set-material-transparency cyl1 0.8)
;; ()

[Top]


entity:set-render-sides

Action
Sets the sidedness of an entity or list of entities.

Filename
scm/scmext/rnd/avh_scm.cpp

APIs
api_rh_set_sidedness

Syntax
(entity:set-render-sides [entity-list] sides)

Arg Types
entity-list entity | (entity ...)
sides integer

Returns
unspecified
Arguments
entity-list specifies any entity or a list of entities.

sides specifies the number of sides to render, which include 0 (undefined sidedness), 1 (single-sided), and 2 (double-sided).
; entity:set-render-sides
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 8 8 0) 20))
;; cyl1
; Set the number of sides for rendering.
(entity:set-render-sides cyl1 2)
;; ()
; Get the number of sides for rendering.
(entity:render-sides cyl1)
;; 2

[Top]


entity:set-texture-space

Action
Sets the texture space associated with an entity.

Filename
scm/scmext/rnd/tmap_scm.cpp

APIs
api_rh_set_texture_space

Syntax
(entity:set-texture-space entity-list texture-space)

Arg Types
entity-list entity | (entity ...)
texture-space entity

Returns
unspecified

Description
The texture space is used during rendering to control how a wrapped material entity is applied to any face or solid body. Refer to texture-space:set-prop for more details.

Arguments
entity-list specifies the entity to set the texture space.

texture-space specifies the texture space entity.
; entity:set-texture-space
; Create a solid block.
(define block1
    (solid:block (position 0 0 0)
    (position -25 -25 -25)))
;; block1
; Create a texture space.
(define texture1 (texture-space "auto axis"))
;; texture1
; Assign the texture space to the block.
(entity:set-texture-space block1 texture1)
;; ()
(define texture (entity:texture-space block1))
;; texture

[Top]


entity:texture-space

Action
Gets the texture space associated with a geometric entity.

Filename
scm/scmext/rnd/tmap_scm.cpp

APIs
api_rh_get_texture_space

Syntax
(entity:texture-space entity)

Arg Types
entity entity

Returns
texture-space
Arguments
entity specifies the entity to query.
; entity:texture-space
; Create a solid block.
(define block1
    (solid:block (position 0 0 0)
    (position 15 25 5)))
;; block1
; Create a texture space.
(define tspace1 (texture-space "auto axis"))
;; tspace1
; Assign the texture space to the block.
(entity:set-texture-space block1 tspace1)
;; ()
; Inquire the texture space assigned to the block.
(entity:texture-space block1)
;; #[entity 3 1]

[Top]


environment-map:data

Action
Creates an environment map from data.

Filename
scm/scmext/rnd/emap_scm.cpp

APIs
api_rh_create_cube_environment

Syntax
(environment-map:data colors widths heights filename)

Arg Types
colors integer
widths integer | (integer ...)
heights integer | (integer ...)
filename string | (integer ...)

Returns
environment-map

Description
This extension creates an environment map from data supplied in a file or the command line.

Environment maps simulate reflections that cannot be viewed in the Basic Rendering Component "flat" or "gouraud" render modes; use the Advanced Rendering Component to view reflections.
An environmental map is an entity associated with rendering reflections. It may be thought of as the six faces of a cube surrounding a model. Each of the inward facing faces contains an image that is wrapped onto reflective objects during rendering. Therefore, environmental maps only provide direction reflections. Reflections of reflections requires ray tracing rendering methods.

Environmental maps are saved when the part is saved. It is represented in the form #[entity m n], where m refers to the entity and n to the part.

Arguments
colors specifies the type of colors supplied; valid options are 1 (grey scale data) or 3 (RGB color data). For grey scale data, each pixel is represented by a single value from 0 (black) to 255 (white). Each pixel of RGB data is represented by three values (one each for red, green, and blue intensity) from 0 (none) to 255 (full). Values for each image are ordered from left-to-right in each row and top-to-bottom for each image. Images are provided in the following order: +X, -X, +Y, -Y, +Z, -Z.

widths and heights arguments specify the sizes in pixels of the six images. If less than six values are given, the extension uses the last specified value for unspecified values.

If filename is a string, it provides the name of a file containing binary image data; otherwise, it is a list containing integer image data.
; environment-map:data
; Create an environment map from the supplied data.
(define emap1
    (environment-map:data 3 20 20 "emap.data"))
;; emap1
; Assign the environment map to an entity.
(render:set-environment-map emap1)
;; ()
; Define a sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Define a material.
(define matter1 (material))
;; matter1
; Set the reflection type to be "environment".
(material:set-reflection-type emap1 "environment")
;; ()
; Set the entity and the material.
(entity:set-material sphere1 matter1)
;; ()
; Set the render mode to full.
(render:set-mode "full")
;; ()
; Render the image.
(render)
;; ()

[Top]


environment-map:lwi

Action
Creates an environment map from .lwi files.

Filename
scm/scmext/rnd/emap_scm.cpp

APIs
api_rh_create_cube_environment

Syntax
(environment-map:lwi img+x img-x
    img+y img-y img+z img-z)

Arg Types
img+x string
img-x string
img+y string
img-y string
img+z string
img-z string

Returns
environment-map

Description
This extension creates a six sided cubical environment map used to simulate reflections. Environment maps simulate reflections that cannot be viewed in the Basic Rendering Component "flat" or "gouraud" render modes. Use the Advanced Rendering Component to view reflections.

An environmental map is an entity associated with rendering reflections. It may be thought of as the six faces of a cube surrounding a model. Each of the inward facing faces contains an image that is wrapped onto reflective objects during rendering. Therefore, environmental maps only provide direction reflections. Reflections of reflections require ray tracing rendering methods. Environmental maps are saved when the part is saved. It is represented in the form #[entity m n], where m refers to the entity and n to the part.

Arguments
img+x, img-x, img+y, img-y, img+z, and img-z are strings specifying the names of the files that holds an image in .lwi (Lightworks Image) format to be mapped to a side of the cube.
; environment-map:lwi
; Create an environment-map from LightWorks
; Image format data files.
(define emap1 (environment-map:lwi
    "xp.lwi" "xm.lwi" "yp.lwi" "ym.lwi"
    "zp.lwi" "zm.lwi"))
;; emap1
; Render the set environment map.
(render:set-environment-map emap1)
;; ()
; Define a sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Define a material.
(define matter1 (material))
;; matter1
; Set the reflection type of the material.
(material:set-reflection-type matter1 "environment")
;; ()
; Set the material onto the sphere.
(entity:set-material sphere1 matter1)
;; ()
; Set the render mode to full.
(render:set-mode "full")
;; ()
; Render the image.
(render)
;; ()

[Top]


light

Action
Creates a light entity.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
api_rh_create_light

Syntax
(light light-type)

Arg Types
light-type string

Returns
light

Description
A light represents a source of illumination in a rendered scene. Light properties can be set using light:set-prop and queried with light:props.

Basic rendering permits the creation and deletion of shadow maps, but does not display shadows. The Advanced Rendering Component supports the display of shadows from certain light types.

Arguments
light-type is a string specifying the light type. Valid values for light-type are "ambient", "distant", "spot", "eye", and "point". The extension light:types also displays the available light types.
; light
; What type of lights are available.
(light:types)
;; ("ambient" "distant" "eye" "point" "spot")
; Create a spot light.
(define light1 (light "spot"))
;; light1

[Top]


light:list

Action
Gets the list of active lights.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
api_rh_get_light_list

Syntax
(light:list)

Arg Types
None

Returns
(light ... )

Description
This extension returns the list of all active lights.

; light:list
; Set active light 1.
(define distant1 (light "distant"))
;; distant1
; Set active light 2.
(define spot1 (light "spot"))
;; spot1
; Set active light 3.
(define ambient1 (light "ambient"))
;; ambient1
; Put the three active lights into the light list.
(light:set #t (list
    distant1 spot1 ambient1))
;; ()
; Get the list of all active lights.
(light:list)
;; (#[entity 2 1] #[entity 3 1] #[entity 4 1])

[Top]


light:on?

Action
Determines if a light entity is active.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
None

Syntax
(light:on? entity)

Arg Types
entity entity

Returns
boolean
Arguments
entity specifies a light entity to be queried.
; light:on?
; Set active light 1.
(define distant1 (light "distant"))
;; distant1
; Determine if a light is active.
(light:on? distant1)
;; #f
(light:set #t distant1)
;; ()
; Determine if a light is active.
(light:on? distant1)
;; #t

[Top]


light:props

Action
Gets the properties of a light.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
api_rh_get_light_args

Syntax
(light:props light-type)

Arg Types
light-type light

Returns
(string (string . string | integer | real | color | gvector) ...)

Description
This extension returns a list of the light-type, followed by pairs containing the property name and the present value.

Arguments
light-type specifies a light entity.
; light:props
; Create a distant light.
(define distant1 (light "distant"))
;; distant1
; Get the properties of the distant light.
(light:props distant1)
;; (("intensity" . 1) ("color" . #[color 1 1 1])
;; ("location" . #[gvector 0 0 1])
;; ("to" . #[gvector 0 0 0]) ("shadows" . #f)
;; ("shadow resolution" . 256) ("shadow quality" . 4)
;; ("shadow softness" . 1))
; Create a spot light.
(define spot1 (light "spot"))
;; spot1
; Get the properties of the spot light.
(light:props spot1)
;; (("intensity" . 1) ("color" . #[color 1 1 1])
;; ("location" . #[gvector 0 0 1])
;; ("to" . #[gvector 0 0 0]) ("fall off" . 0)
;; ("cone angle" . 60) ("cone delta angle" . 5)
;; ("beam distribution" . 2) ("shadows" . #f)
;; ("shadow resolution" . 256) ("shadow quality" . 4)
;; ("shadow softness" . 1))

Top]


light:set

Action
Sets the list of currently-active lights.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
api_rh_get_light_list, api_rh_set_light_list, api_rh_set_light_state

Syntax
(light:set on-off light-list)

Arg Types
on-off boolean
light-list light | (light ... )

Returns
unspecified

Description
Before executing this extension, create lights and set their parameters.

Arguments
Set on-off to true (#t) to activate the lights specified in the list or false (#f) to deactivate the lights. Setting on-off to true (#t) adds the lights to the global light list and setting it to false removes the lights from the global list.

light-list specifies a list of lights to be activated.
; light:set
; Set active light 1.
(define distant1 (light "distant"))
;; distant1
; Set active light 2.
(define spot1 (light "spot"))
;; spot1
; Set active light 3.
(define ambient1 (light "ambient"))
;; ambient1
; Put the three active lights into the light list.
(light:set #t (list
    distant1 spot1 ambient1))
;; ()
; Get the list of all active lights.
(light:list)
;; (#[entity 2 1] #[entity 3 1] #[entity 4 1])

[Top]


light:set-prop

Action
Sets a property of a light.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
api_rh_get_light_args, api_rh_set_light_arg

Syntax
(light:set-prop light name value)

Arg Types
light light
name string
value real | integer | string | color | gvector

Returns
unspecified

Description
The following lists the property names and associated default values.

Note:
Only property names and values associated with a specific light entity can be set.

"ambient" illuminates all surfaces equally regardless of orientation. The intensity of the source (as a scalar quantity) is determined by intensity and color. The default values are:

intensity 1.0 (real)
color #[color 1 1 1]

"distant" projects parallel light from a distant source. An orthographic projection is set up with a camera positioned at the location point of the light and directed towards the to point of the light. Clipping planes are set to ensure that entities are not excluded. The default values are:

intensity 1.0 (real)
color #[color 1 1 1]
location #[gvector 0 0 1]
to #[gvector 0 0 0]
shadows #f (boolean)
shadow resolution 256 (int)
shadow quality 4 (int)
shadow softness 1.0 (real)

"spot" directs light from a spot source constrained to a cone. A perspective projection is set up with a camera positioned at the light's location point, and directed towards the light's to point. The field of view is specified by cone angle. Clipping planes are set to exclude entities behind the light. The default values are:

intensity 1.0 (real)
color #[color 1 1 1]
location #[gvector 0 0 1]
to #[gvector 0 0 0]
fall off 0 (integer)
cone angle 0.0 (real)
cone delta angle 5.0 (real)
beam distribution 2.0 (real)
shadows #f (boolean)
shadow resolution 256 (int)
shadow quality 4 (int)
shadow softness 1.0 (real)

"eye" emits light from the view position. No shadows are ever cast from an eye light. The default values are:

intensity 1.0 (real)
color #[color 1 1 1]

"point" emits light from a point equally in all directions. The position of the light is specified by location. The default values are:

intensity 1.0 (real)
color #[color 1 1 1]
location #[gvector 0 0 1]
fall off 0 (integer)
shadows #f (boolean)
shadow resolution 256 (int)
shadow quality 4 (int)
shadow softness 1.0 (real)
Arguments
light specifies the light entity.

name specifies the property name that attaches to the light entity.

value specifies the value associated with the property name.
; light:set-prop
; Create a spot light.
(define spot1 (light "spot"))
;; spot1
; Get the properties of the spot light.
(light:props spot1)
;; (("intensity" . 1) ("color" . #[color 1 1 1])
;; ("location" . #[gvector 0 0 1])
;; ("to" . #[gvector 0 0 0]) ("fall off" . 0)
;; ("cone angle" . 60) ("cone delta angle" . 5)
;; ("beam distribution" . 2) ("shadows" . #f)
;; ("shadow resolution" . 256) ("shadow quality" . 4)
;; ("shadow softness" . 1))
; Set properties for the spot light.
(light:set-prop spot1 "color"
    (color:rgb 0.5 0.5 0.5))
;; ()
; Get the properties of the spot light.
(light:props spot1)
;; (("intensity" . 1)
;; ("color" . #[color 0.5 0.5 0.5])
;; ("location" . #[gvector 0 0 1])
;; ("to" . #[gvector 0 0 0]) ("fall off" . 0)
;; ("cone angle" . 60) ("cone delta angle" . 5)
;; ("beam distribution" . 2) ("shadows" . #f)
;; ("shadow resolution" . 256) ("shadow quality" . 4)
;; ("shadow softness" . 1))
; Create a point light.
(define point1 (light "point"))
;; point1
; Set properties for the point light.
(light:set-prop point1 "shadows" 1)
;; ()

[Top]


light:type

Action
Gets the type of a light.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
api_rh_get_light_args

Syntax
(light:type light)

Arg Types
light light

Returns
string
Arguments
light specifies a light entity.
; light:type
; Create a spot light.
(define spot1 (light "spot"))
;; spot1
; Determine the type of light.
(light:type spot1)
;; "spot"

[Top]


light:types

Action
Gets a list of available light types.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
api_rh_get_light_types

Syntax
(light:types)

Arg Types
None

Returns
(string ... )

Description
This extension returns all valid light types as a list of strings.

; light:types
; Get a list of the available light types.
(light:types)
;; ("ambient" "distant" "eye" "point" "spot")

[Top]


light?

Action
Determines if a Scheme object is a light.

Filename
scm/scmext/rnd/lite_scm.cpp

APIs
None

Syntax
(light? object)

Arg Types
object scheme-object

Returns
boolean
Arguments
object specifies the scheme-object that has to be queried for a light.
; light?
; Create a spot light.
(define light1 (light "spot"))
;; light1
; Determine if the object is a light.
(light? light1)
;; #t

[Top]