tjheldna Posted September 20, 2014 Share Posted September 20, 2014 I'm just taking a look at Shadmar's Day Night code to recreate it in my C++ project and trying to make sense of this this line, but can't work out where the .k is coming from? I can see where all the others are though self.dir = Vec3(light.mat.k.x,light.mat.k.y,light.mat.k.z):Normalize() Script.DaySpeedXYZ=Vec3(0.1,0.0,0.0)--Vec3 Script.FollowCamera=true--bool Script.mieDirectionalG=0.8--float Script.mieCoefficient=0.02--float Script.turbidity=4.0--float Script.reileighCoeff=3.0--float Script.luminance=0.7--float Script.yoffset=200.0--float Script.bloomadjust=1.0--float Script.cloudspeed=0.08--float Script.cloudcover=0.6--float Script.cloudthickness=1.0--float Script.cloudheight=0.08--float Script.cloudscale=0.05--float Script.cloudmix=1.0--float Script.cloudcolor=Vec3(.7,.7,.7)--Vec3 Script.bloomvalues=Vec3(0.11,0.158,0.298) function Script:Start() self.mat=Material:Load("Materials/DayNight/daynight.mat") self.shader=self.mat:GetShader() self.world=World:GetCurrent() --load fog shader so we can color the fog. --self.fog=Shader:Load("Shaders/PostEffects/EffectClass/_klepto_fog.shader") end function Script:UpdateWorld() --Day cycle self.entity:Turn(self.DaySpeedXYZ.x*Time:GetSpeed(),self.DaySpeedXYZ.y*Time:GetSpeed(),self.DaySpeedXYZ.z*Time:GetSpeed()) --Get Sun vector light=self.entity self.dir = Vec3(light.mat.k.x,light.mat.k.y,light.mat.k.z):Normalize() --Send sun vector to shader self.shader:SetVec3("sunPos",Vec3(-self.dir.x,-self.dir.y,-self.dir.z)) Cheers Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 20, 2014 Share Posted September 20, 2014 Maybe a matrix index? Oftopic to your problem: Shadmar created these effects for C++. https://github.com/Aggror/LeadwerksRenderFramework Quote Link to comment Share on other sites More sharing options...
Rick Posted September 20, 2014 Share Posted September 20, 2014 A light is an entity and if you look at the top of this page it has a mat variable which is a Mat4 type http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/ The Mat4 type has a k vairable http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/mat4/ 1 Quote Link to comment Share on other sites More sharing options...
tjheldna Posted September 20, 2014 Author Share Posted September 20, 2014 Thanks guys you are right, I was thinking the variable was a Material not a matrix. Kudos to Shadmar for the help too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.