Jump to content

Set color to the light ?


wh1sp3r
 Share

Recommended Posts

I have problem to set a color to my directional light

 

local light = class:GetLight() -- this function returns first direction light handle

light:SetColor( Vec4(1.0/255.0, 0.0/255.0, 0.0/255.0 ,1.0) )

 

 

light handle is OK, because i can rotate light but i can'T set color.

 

thank you

-= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=-

Website: http://www.flamewarestudios.com

Link to comment
Share on other sites

hmmm this seems to work fine for me...

 

require("scripts/class")

local class=CreateClass(...)

function class:GetLight()
class = classnametable[ "light_directional" ]
if class~=nil then
	for model,object in pairs(class.instances) do
		return model
	end
end
end 

function class:CreateObject(model)
local object=self.super:CreateObject(model)

local light=class:GetLight()
light:SetColor(Vec4(0,1,0,1), 1)
end

 

when I place the entity that has this script into the scene it instantly changes the directional light's color...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...