GetIntensity
This function gets the intensity of an entity's color. The intensity is a multiplier used to increase or decrease the brightness of an entity's color.
Syntax
- GetIntensity(mode=Color.Diffuse)
Parameters
- mode: (number): the color mode to use. This may be Entity::DiffuseColor or Entity::SpecularColor.
Returns
(number)
Returns the entity color intensity.
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-5)
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