DirectionalLight now correctly getting directions
This commit is contained in:
@@ -16,7 +16,7 @@ struct DirectionalLightJob : RenderJob
|
||||
: RenderJob()
|
||||
{
|
||||
|
||||
Direction = glm::vec4(0,0,-1,0) * Transform::AbsoluteOrientation(m_World, transformComponent.EntityID);
|
||||
Direction = glm::vec4(0,0,-1,0) * glm::inverse(Transform::AbsoluteOrientation(m_World, transformComponent.EntityID));
|
||||
//Direction = glm::vec4((glm::vec3)directionalLightComponent["Direction"], 0.f);
|
||||
Color = (glm::vec4)directionalLightComponent["Color"];
|
||||
Intensity = (double)directionalLightComponent["Intensity"];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<c:DirectionalLight>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<DirectionalLight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DirectionalLight.xsd">
|
||||
<Color R="1" G="1" B="1" A="1"/>
|
||||
<Intensity>0.8</Intensity>
|
||||
<Visible>true</Visible>
|
||||
</c:DirectionalLight>
|
||||
</DirectionalLight>
|
||||
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
|
||||
<xs:element name="DirectionalLight">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A directional light that shines bright like the future.</xs:documentation>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Scale X="100" Y="1" Z="100"/>
|
||||
<Orientation X="0" Y="2.59200001" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
@@ -45,9 +46,58 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Listener/>
|
||||
<c:Transform>
|
||||
<Position X="5.85247707" Y="3.8454349" Z="-1.14486957"/>
|
||||
<Orientation X="2.51327395" Y="1.23916209" Z="-3.1415925"/>
|
||||
<Position X="-3.7727046" Y="4.42466021" Z="5.32631207"/>
|
||||
<Orientation X="-0.174533114" Y="-0.62824142" Z="-6.35425181e-07"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:DirectionalLight/>
|
||||
<c:Model>
|
||||
<Resource>Models/DirectionalLightWidget.obj</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.37382936" Z="0"/>
|
||||
<Orientation X="1.4920001" Y="1.96300006" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.obj</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-2.00568962" Y="0.527161121" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/SecondaryWeapon4.fbx</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.545270562" Y="0.859505534" Z="0.188573226"/>
|
||||
<Orientation X="1.47266471" Y="0.524984181" Z="1.243698"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="3.70000029" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<xs:element ref="c:SpawnPoint" minOccurs="0"/>
|
||||
<xs:element ref="c:PlayerSpawn" minOccurs="0"/>
|
||||
<xs:element ref="c:Team" minOccurs="0"/>
|
||||
<xs:element ref="c:DirectionalLight" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -88,7 +88,7 @@ LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightCol
|
||||
|
||||
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
|
||||
{
|
||||
vec4 L = normalize( -direction );
|
||||
vec4 L = normalize( -vec4(direction.xyz, 0) );
|
||||
|
||||
LightResult result;
|
||||
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
|
||||
|
||||
@@ -29,6 +29,6 @@ void main()
|
||||
|
||||
Output.Position = Position;
|
||||
Output.TextureCoordinate = TextureCoords;
|
||||
Output.Normal = Normal;
|
||||
Output.Normal = vec3(M * vec4(Normal, 0.0));
|
||||
Output.DiffuseColor = DiffuseVertexColor;
|
||||
}
|
||||
Reference in New Issue
Block a user