SinglePass now uses the TechniqueDef LightSpace.
The single pass material definition LightSpace has been set to View until we implement it in world space.
This commit is contained in:
parent
d662eadce9
commit
cecf355c70
@ -788,9 +788,8 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
Vector3f dir = dl.getDirection();
|
||||
//Data directly sent in view space to avoid a matrix mult for each pixel
|
||||
tmpVec.set(dir.getX(), dir.getY(), dir.getZ(), 0.0f);
|
||||
rm.getCurrentCamera().getViewMatrix().mult(tmpVec, tmpVec);
|
||||
// tmpVec.divideLocal(tmpVec.w);
|
||||
// tmpVec.normalizeLocal();
|
||||
transposeLightDataToSpace(technique.getDef().getLightSpace(), rm, tmpVec);
|
||||
|
||||
lightData.setVector4InArray(tmpVec.getX(), tmpVec.getY(), tmpVec.getZ(), -1, lightDataIndex);
|
||||
lightDataIndex++;
|
||||
//PADDING
|
||||
@ -802,8 +801,8 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
Vector3f pos = pl.getPosition();
|
||||
float invRadius = pl.getInvRadius();
|
||||
tmpVec.set(pos.getX(), pos.getY(), pos.getZ(), 1.0f);
|
||||
rm.getCurrentCamera().getViewMatrix().mult(tmpVec, tmpVec);
|
||||
//tmpVec.divideLocal(tmpVec.w);
|
||||
transposeLightDataToSpace(technique.getDef().getLightSpace(), rm, tmpVec);
|
||||
|
||||
lightData.setVector4InArray(tmpVec.getX(), tmpVec.getY(), tmpVec.getZ(), invRadius, lightDataIndex);
|
||||
lightDataIndex++;
|
||||
//PADDING
|
||||
@ -817,17 +816,13 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
float invRange = sl.getInvSpotRange();
|
||||
float spotAngleCos = sl.getPackedAngleCos();
|
||||
tmpVec.set(pos2.getX(), pos2.getY(), pos2.getZ(), 1.0f);
|
||||
rm.getCurrentCamera().getViewMatrix().mult(tmpVec, tmpVec);
|
||||
// tmpVec.divideLocal(tmpVec.w);
|
||||
transposeLightDataToSpace(technique.getDef().getLightSpace(), rm, tmpVec);
|
||||
|
||||
lightData.setVector4InArray(tmpVec.getX(), tmpVec.getY(), tmpVec.getZ(), invRange, lightDataIndex);
|
||||
lightDataIndex++;
|
||||
|
||||
//We transform the spot direction in view space here to save 5 varying later in the lighting shader
|
||||
//one vec4 less and a vec4 that becomes a vec3
|
||||
//the downside is that spotAngleCos decoding happens now in the frag shader.
|
||||
tmpVec.set(dir2.getX(), dir2.getY(), dir2.getZ(), 0.0f);
|
||||
rm.getCurrentCamera().getViewMatrix().mult(tmpVec, tmpVec);
|
||||
tmpVec.normalizeLocal();
|
||||
transposeLightDataToSpace(technique.getDef().getLightSpace(), rm, tmpVec);
|
||||
lightData.setVector4InArray(tmpVec.getX(), tmpVec.getY(), tmpVec.getZ(), spotAngleCos, lightDataIndex);
|
||||
lightDataIndex++;
|
||||
break;
|
||||
|
@ -117,6 +117,7 @@ MaterialDef Phong Lighting {
|
||||
|
||||
Technique {
|
||||
LightMode SinglePass
|
||||
LightSpace View
|
||||
|
||||
VertexShader GLSL100: Common/MatDefs/Light/SPLighting.vert
|
||||
FragmentShader GLSL100: Common/MatDefs/Light/SPLighting.frag
|
||||
|
Loading…
x
Reference in New Issue
Block a user