GetColor
This function gets an entity's color.
Syntax
- GetColor(mode=Color.Diffuse)
Parameters
- mode: (number): the color to get. This may be Color.Diffuse or Color.Specular.
Returns
Returns a Vec4 containing the entity color.
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
--Create a model
entity = Model:Box()
entity :SetColor(1.0,0.5,0.25)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
entity :SetIntensity(Math:Sin(Time:GetCurrent()/10.0)+1.5)
context:SetBlendMode(Blend.Alpha)
context:DrawText("Color: "..entity:GetColor():ToString(),2,2)
context:DrawText("Intensity: "..entity:GetIntensity(),2,22)
context:Sync()
end