DarkBASIC Professional Help Wiki
Advertisement


This command will alter the material ambience component of the object.

Syntax
SET OBJECT AMBIENCE Object Number, Color Value
Parameters
Object Number

Integer
The object number Color Value Dword
This number will specifically the amount of global ambient light it receives

Returns

This command does not return a value.

Description

The ambience component makes up one of the factors that controls the final colour of the object, specifically the amount of global ambient light it receives. If the global ambient was red, and this component was set to white, the object would receive "full" ambient light and drown out any lighting otherwise applied to the object. The object would be completely red. This command should not be confused with SET OBJECT AMBIENT which controls the flag which states whether the object receives any ambient light whatsoever.

Example Code
sync on : sync rate 60 : hide mouse:cls 0:color backdrop 0

fog on:fog color 0:set ambient light 50

ObjectNumber=2:ImageNumber=2

wire=0:trans=0:cull=0:fliter=0:light=0:fog=0:ambient=0

set global object creation 0

set dir "models"

load object "ast4.x",ObjectNumber

set object specular ObjectNumber,0

rotate object ObjectNumber,270,0,0

set dir ".."

while mouseclick()<>2

set cursor 0,0

print "press 1 to SET OBJECT AMBIENCE";255:if inkey$()="1" then SET OBJECT AMBIENCE ObjectNumber,rgb(0,0,255)

print "press 2 to SET OBJECT DIFFUSE":if inkey$()="2" then SET OBJECT DIFFUSE ObjectNumber,rgb(0,0,255),0

print "press 3 to SET OBJECT EMISSIVE";255:if inkey$()="3" then SET OBJECT EMISSIVE ObjectNumber,rgb(0,0,255)

print "press 4 to SET OBJECT FOV";90:if inkey$()="4" then SET OBJECT FOV ObjectNumber,90

print "press 5 to SET OBJECT NORMALS":if inkey$()="5" then SET OBJECT NORMALS ObjectNumber

print "press 6 to SET OBJECT RADIUS";5:if inkey$()="6" then SET OBJECT RADIUS ObjectNumber,5

print "press 7 to SET OBJECT SMOOTHING";100:if inkey$()="7" then SET OBJECT SMOOTHING ObjectNumber,100

print "press 8 to SET OBJECT SPECULAR POWER";50:if inkey$()="8" then SET OBJECT SPECULAR POWER ObjectNumber,50

print "press 9 to SET OBJECT SPECULAR";255:if inkey$()="9" then SET OBJECT SPECULAR ObjectNumber,rgb(0,0,255)

while scancode()<>0:endwhile

if mouseclick()=1 then yrotate object ObjectNumber,wrapvalue(object angle y(ObjectNumber)+1)

sync

endwhile

while mouseclick()=1:endwhile

delete object ObjectNumber

end
Advertisement