|
Action:
|
Sets the reflection properties in the material associated with a geometric entity.
|
|
|
Filename:
|
rbase/rnd_scm/mat_scm.cxx
|
|
|
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. For information about reflection properties is given in
material:set-reflection-prop.
|
|
|
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.
|
|
|
Example:
|
; 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)
|
|
;; ()
|