Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 17.23 KB | None | 0 0
  1. package engine.rendering.lighting;
  2.  
  3. import static org.lwjgl.opengl.GL11.*;
  4. import static org.lwjgl.opengl.GL15.*;
  5. import static org.lwjgl.opengl.GL20.*;
  6. import static org.lwjgl.opengl.GL30.*;
  7. import static org.lwjgl.opengl.GL32.GL_DEPTH_CLAMP;
  8.  
  9. import java.io.File;
  10. import java.nio.FloatBuffer;
  11. import java.nio.ShortBuffer;
  12. import java.util.ArrayList;
  13.  
  14. import org.lwjgl.BufferUtils;
  15. import org.lwjgl.util.vector.Matrix3f;
  16. import org.lwjgl.util.vector.Matrix4f;
  17. import org.lwjgl.util.vector.Quaternion;
  18. import org.lwjgl.util.vector.Vector3f;
  19. import org.lwjgl.util.vector.Vector4f;
  20.  
  21. import engine.rendering.etc.FastArrayList;
  22. import engine.rendering.gl.culling.FrustumCuller;
  23. import engine.rendering.gl.shader.Shader;
  24. import engine.rendering.gl.shader.ShaderProgram;
  25. import engine.rendering.gl.view.RenderView;
  26. import engine.rendering.gl.view.ShadowView;
  27. import engine.rendering.gl.view.View;
  28. import engine.rendering.lighting.shadow.Rectangle;
  29. import engine.rendering.lighting.shadow.RectanglePacker;
  30. import engine.rendering.lighting.shadow.ShadowSystem;
  31. import engine.rendering.rt.RenderTargets;
  32. import engine.rendering.util.MatrixUtils;
  33. import engine.rendering.util.QuatUtils;
  34. import engine.rendering.util.ScalarUtils;
  35. import engine.rendering.util.TextureUtils;
  36.  
  37.  
  38. public class ConeLightRenderer {
  39.    
  40.     private static final float SHADOW_NEAR_PLANE = 0.125f;
  41.    
  42.     private RenderTargets renderTargets;
  43.     private ShadowSystem shadowSystem;
  44.    
  45.     private int vbo, ibo;
  46.     private int numIndices;
  47.  
  48.     private UnshadowedShader unshadowedShader;
  49.     private ShadowedShader shadowedShader;
  50.     private FloatBuffer matrixBuffer;
  51.     private int unshadowedVAO, shadowedVAO;
  52.    
  53.     private Matrix3f tempMatrix;
  54.  
  55.     private FastArrayList<ConeLightImpl> lights0, lights1;
  56.     private FastArrayList<ConeLightImpl> unshadowedLights;
  57.     private FastArrayList<ConeLightImpl> shadowedLights;
  58.    
  59.     private RectanglePacker<ConeLightImpl> shadowMapPacker;
  60.  
  61.     public ConeLightRenderer(RenderTargets renderTargets, ShadowSystem shadowSystem, String shaderPath, int subdivisions) {
  62.         this.renderTargets = renderTargets;
  63.         this.shadowSystem = shadowSystem;
  64.        
  65.         generateCone(subdivisions);
  66.         initShaders(shaderPath + "lighting/cone/");
  67.        
  68.         tempMatrix = new Matrix3f();
  69.  
  70.         lights0 = new FastArrayList<>();
  71.         lights1 = new FastArrayList<>();
  72.         unshadowedLights = new FastArrayList<>();
  73.         shadowedLights = new FastArrayList<>();
  74.        
  75.         shadowMapPacker = new RectanglePacker<>(shadowSystem.getWidth(), shadowSystem.getHeight());
  76.     }
  77.  
  78.     private void generateCone(int subdivisions) {
  79.        
  80.         ConeGenerator coneGenerator = new ConeGenerator();
  81.         coneGenerator.create(subdivisions);
  82.        
  83.         vbo = glGenBuffers();
  84.         glBindBuffer(GL_ARRAY_BUFFER, vbo);
  85.         Vector3f[] positionData = coneGenerator.getPositions();
  86.        
  87.         FloatBuffer positionBuffer = BufferUtils.createFloatBuffer(positionData.length * 3);
  88.         for(int i = 0; i < positionData.length; i++){
  89.             Vector3f p = positionData[i];
  90.             positionBuffer.put(p.x).put(p.y).put(p.z);
  91.         }
  92.         positionBuffer.flip();
  93.                
  94.         glBufferData(GL_ARRAY_BUFFER, positionBuffer, GL_STATIC_DRAW);
  95.        
  96.         ibo = glGenBuffers();
  97.         glBindBuffer(GL_ARRAY_BUFFER, ibo);
  98.         short[] indexData = coneGenerator.getIndices();
  99.         ShortBuffer indexBuffer = BufferUtils.createShortBuffer(indexData.length);
  100.         indexBuffer.put(indexData).flip();
  101.         glBufferData(GL_ARRAY_BUFFER, indexBuffer, GL_STATIC_DRAW);
  102.        
  103.         numIndices = indexData.length;
  104.        
  105.     }
  106.    
  107.     private void initShaders(String shaderPath) {
  108.         unshadowedShader = new UnshadowedShader(shaderPath);
  109.         shadowedShader = new ShadowedShader(shaderPath, shadowSystem.getShadowSampleShader());
  110.        
  111.         matrixBuffer = BufferUtils.createFloatBuffer(16);
  112.        
  113.         unshadowedVAO = unshadowedShader.createVAO();
  114.         shadowedVAO = shadowedShader.createVAO();
  115.     }
  116.    
  117.     public ConeLight newLight(){
  118.         ConeLightImpl l = new ConeLightImpl();
  119.         lights0.add(l);
  120.         return l;
  121.     }
  122.    
  123.     public void clear() {
  124.         lights0.clear();
  125.     }
  126.    
  127.     public void cull(RenderView cameraView, ArrayList<View> result){
  128.        
  129.         MatrixUtils.extract(cameraView.getViewMatrix(), tempMatrix);
  130.        
  131.         FrustumCuller culler = cameraView.getCuller();
  132.         Matrix4f viewMatrix = cameraView.getViewMatrix();
  133.        
  134.  
  135.         int minResolution = shadowSystem.getMinShadowResolution();
  136.         int maxResolution = shadowSystem.getMaxPointLightResolution();
  137.  
  138.         unshadowedLights.clear();
  139.         shadowedLights.clear();
  140.        
  141.         for(int i = 0; i < lights0.size(); i++){
  142.            
  143.             ConeLightImpl cl = lights0.get(i);
  144.            
  145.             if(cl.disposed){
  146.                 continue;
  147.             }
  148.            
  149.             lights1.add(cl);
  150.            
  151.             float intensity = cl.intensity;
  152.             Vector4f position = cl.position;
  153.            
  154.             if(intensity > 0 && culler.sphereVisible(position, intensity)){
  155.            
  156.                 cl.update(viewMatrix, tempMatrix);
  157.                
  158.                 if(!cl.shadowsEnabled){
  159.                     unshadowedLights.add(cl);
  160.                 }else{
  161.  
  162.                     cl.updateShadowResolution(minResolution, maxResolution);
  163.                     cl.updateShadowMatrix(cameraView);
  164.                     result.add(cl.view);
  165.                    
  166.                     shadowedLights.add(cl);
  167.                 }
  168.             }
  169.         }
  170.        
  171.         lights0.clear();
  172.        
  173.        
  174.         FastArrayList<ConeLightImpl> temp = lights0;
  175.         lights0 = lights1;
  176.         lights1 = temp;
  177.     }
  178.    
  179.     public void packShadowMaps(){
  180.         shadowMapPacker.pack(shadowedLights);
  181.     }
  182.    
  183.     public void renderUnshadowedLights(RenderView view){
  184.  
  185.        
  186.         unshadowedShader.bind();
  187.        
  188.         glUniform2f(unshadowedShader.screenSizeLocation, 1f/renderTargets.getWidth(), 1f/renderTargets.getHeight());
  189.        
  190.         uploadMatrix4(view.getViewProjectionMatrix(), unshadowedShader.viewProjectionMatrixLocation);
  191.         uploadMatrix4(view.getInverseProjectionMatrix(), unshadowedShader.inverseProjectionMatrixLocation);
  192.        
  193.  
  194.         glEnable(GL_STENCIL_TEST);
  195.        
  196.         glBindVertexArray(unshadowedVAO);
  197.        
  198.         for(int j = 0; j < unshadowedLights.size(); j++){
  199.            
  200.             ConeLightImpl l = unshadowedLights.get(j);
  201.            
  202.             uploadMatrix4(l.objectMatrix, unshadowedShader.objectMatrixLocation);
  203.            
  204.             Vector4f p = l.eyeSpacePosition;
  205.             glUniform3f(unshadowedShader.lightEyePositionLocation, p.x, p.y, p.z);
  206.             Vector3f d = l.eyeSpaceDirection;
  207.             glUniform3f(unshadowedShader.lightEyeDirectionLocation, d.x, d.y, d.z);
  208.            
  209.             glUniform3f(unshadowedShader.lightColorLocation, l.r, l.g, l.b);
  210.             glUniform1f(unshadowedShader.lightIntensityLocation, l.intensity);
  211.            
  212.             glUniform1f(unshadowedShader.cosineCutoffLocation, l.cosineCutoff);
  213.             glUniform1f(unshadowedShader.edgeDimmingLocation, l.edgeDimming);
  214.            
  215.             glCullFace(GL_BACK);
  216.             glStencilFunc(GL_ALWAYS, 0, 0xFF);
  217.             glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
  218.             glColorMask(false, false, false, false);
  219.            
  220.             glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_SHORT, 0);
  221.  
  222.             glCullFace(GL_FRONT);
  223.             glStencilFunc(GL_EQUAL, 0, 0xFF);
  224.             glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO);
  225.             glColorMask(true, true, true, true);
  226.            
  227.             glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_SHORT, 0);
  228.            
  229.            
  230.         }
  231.        
  232.         glDisable(GL_STENCIL_TEST);
  233.     }
  234.    
  235.     public void renderShadowedLights(RenderView cameraView) {
  236.        
  237.         shadowedShader.bind();
  238.  
  239.         glUniform2f(shadowedShader.screenSizeLocation, 1f/renderTargets.getWidth(), 1f/renderTargets.getHeight());
  240.        
  241.         uploadMatrix4(cameraView.getViewProjectionMatrix(), shadowedShader.viewProjectionMatrixLocation);
  242.         uploadMatrix4(cameraView.getInverseProjectionMatrix(), shadowedShader.inverseProjectionMatrixLocation);
  243.        
  244.        
  245.         shadowMapPacker.pack(shadowedLights);
  246.         int passes = shadowMapPacker.getNumPasses();
  247.        
  248.         for(int i = 0; i < passes; i++){
  249.            
  250.             FastArrayList<ConeLightImpl> lights = shadowMapPacker.getPass(i);
  251.             int numLights = lights.size();
  252.  
  253.             shadowSystem.startShadowMapRendering(numLights);
  254.            
  255.             for(int j = 0; j < numLights; j++){
  256.                 ConeLightImpl l = lights.get(j);
  257.                 shadowSystem.renderShadowMap(l.x, l.y, l.requestedResolution, l.shadowBias, l.shadowSlopeBias, l.view);
  258.             }
  259.            
  260.             shadowSystem.prefilter();
  261.            
  262.            
  263.             renderTargets.bindAccumulationPassFBO();
  264.            
  265.             shadowedShader.bind();
  266.  
  267.             TextureUtils.setActiveUnit(0);
  268.             renderTargets.getGBuffer0().bind();
  269.            
  270.             TextureUtils.setActiveUnit(1);
  271.             renderTargets.getGBuffer1().bind();
  272.            
  273.             TextureUtils.setActiveUnit(2);
  274.             renderTargets.getDepthBuffer().bind();
  275.            
  276.             shadowSystem.bindShadowMaps(3);
  277.            
  278.             TextureUtils.setActiveUnit(0);
  279.            
  280.             glEnable(GL_BLEND);
  281.             glBlendFunc(GL_ONE, GL_ONE);
  282.             glEnable(GL_CULL_FACE);
  283.             glCullFace(GL_FRONT);
  284.             glEnable(GL_DEPTH_TEST);
  285.             glDepthFunc(GL_GREATER);
  286.             glEnable(GL_DEPTH_CLAMP);
  287.             glDepthMask(false);
  288.            
  289.            
  290.             glBindVertexArray(shadowedVAO);
  291.  
  292.             for(int j = 0; j < numLights; j++){
  293.                
  294.                 ConeLightImpl l = lights.get(j);
  295.                
  296.                 uploadMatrix4(l.objectMatrix, shadowedShader.objectMatrixLocation);
  297.                 uploadMatrix4(l.inverseViewLightMatrix, shadowedShader.inverseViewLightMatrixLocation);
  298.                
  299.                 glUniform2f(shadowedShader.shadowOffsetLocation, (float)l.x / shadowSystem.getWidth(), (float)l.y / shadowSystem.getHeight());
  300.                 glUniform2f(shadowedShader.shadowResolutionLocation, (float)l.requestedResolution / shadowSystem.getWidth(), (float)l.requestedResolution / shadowSystem.getHeight());
  301.                
  302.                 Vector4f p = l.eyeSpacePosition;
  303.                 glUniform3f(shadowedShader.lightEyePositionLocation, p.x, p.y, p.z);
  304.                 Vector3f d = l.eyeSpaceDirection;
  305.                 glUniform3f(shadowedShader.lightEyeDirectionLocation, d.x, d.y, d.z);
  306.                
  307.                 glUniform3f(shadowedShader.lightColorLocation, l.r, l.g, l.b);
  308.                 glUniform1f(shadowedShader.lightIntensityLocation, l.intensity);
  309.                
  310.                 glUniform1f(shadowedShader.cosineCutoffLocation, l.cosineCutoff);
  311.                 glUniform1f(shadowedShader.edgeDimmingLocation, l.edgeDimming);
  312.                
  313.                 glCullFace(GL_BACK);
  314.                 glStencilFunc(GL_ALWAYS, 0, 0xFF);
  315.                 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
  316.                 glColorMask(false, false, false, false);
  317.                
  318.                 glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_SHORT, 0);
  319.  
  320.                 glCullFace(GL_FRONT);
  321.                 glStencilFunc(GL_EQUAL, 0, 0xFF);
  322.                 glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO);
  323.                 glColorMask(true, true, true, true);
  324.                
  325.                 glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_SHORT, 0);
  326.             }
  327.            
  328.             glDisable(GL_STENCIL_TEST);
  329.             glDisable(GL_BLEND);
  330.             glDisable(GL_CULL_FACE);
  331.             glCullFace(GL_BACK);
  332.             glDisable(GL_DEPTH_TEST);
  333.             glDepthFunc(GL_LESS);
  334.             glDepthMask(true);
  335.             glDisable(GL_DEPTH_CLAMP);
  336.         }
  337.         shadowMapPacker.clear();
  338.     }
  339.  
  340.     private void uploadMatrix4(Matrix4f matrix, int uniform) {
  341.         matrix.store(matrixBuffer);
  342.         matrixBuffer.flip();
  343.         glUniformMatrix4(uniform, false, matrixBuffer);
  344.     }
  345.    
  346.     public void setRenderTargets(RenderTargets renderTargets){
  347.         this.renderTargets = renderTargets;
  348.     }
  349.    
  350.     private class ConeLightImpl extends ConeLight implements Rectangle{
  351.  
  352.         private Vector3f normalizedDirection;
  353.         private Matrix4f objectMatrix;
  354.        
  355.         private Vector4f eyeSpacePosition;
  356.         private Vector3f eyeSpaceDirection;
  357.        
  358.         private float cosineCutoff;
  359.        
  360.        
  361.         private boolean shadowsEnabled;
  362.        
  363.         private Vector3f up, target;
  364.         private Matrix4f viewMatrix, projectionMatrix;
  365.         private ShadowView view;
  366.         private Matrix4f inverseViewLightMatrix;
  367.        
  368.  
  369.         //Shadow map packing values
  370.         private int requestedResolution;
  371.        
  372.         private int x, y;
  373.        
  374.        
  375.         private boolean disposed;
  376.        
  377.        
  378.         public ConeLightImpl() {
  379.  
  380.             normalizedDirection = new Vector3f();
  381.             objectMatrix = new Matrix4f();
  382.            
  383.             eyeSpacePosition = new Vector4f();
  384.             eyeSpaceDirection = new Vector3f();
  385.            
  386.             shadowsEnabled = false;
  387.             disposed = false;
  388.         }
  389.  
  390.         @Override
  391.         public void dispose() {
  392.             disposed = true;
  393.         }
  394.        
  395.         @Override
  396.         public boolean areShadowsEnabled() {
  397.             return this.shadowsEnabled;
  398.         }
  399.  
  400.         @Override
  401.         public void setShadowsEnabled(boolean shadowsEnabled) {
  402.             if(shadowsEnabled && viewMatrix == null){
  403.                
  404.                 target = new Vector3f();
  405.                 up = new Vector3f();
  406.                
  407.                 viewMatrix = new Matrix4f();
  408.                 projectionMatrix = new Matrix4f();
  409.                
  410.                 view = new ShadowView(viewMatrix, projectionMatrix, true);
  411.                 inverseViewLightMatrix = new Matrix4f();
  412.                
  413.             }
  414.             this.shadowsEnabled = shadowsEnabled;
  415.         }
  416.        
  417.         public void update(Matrix4f viewMatrix, Matrix3f rotationMatrix){
  418.            
  419.             cosineCutoff = (float)Math.cos(Math.toRadians(fov*0.5f));
  420.            
  421.             normalizedDirection.set(direction).normalise();
  422.            
  423.             Vector3f f = new Vector3f(0, 0, 1);
  424.             Vector3f v = new Vector3f();
  425.            
  426.             Vector3f.cross(f, normalizedDirection, v);
  427.             float angle = (float)Math.acos(Vector3f.dot(f, normalizedDirection));
  428.            
  429.             Quaternion tempQuat = new Quaternion();
  430.             QuatUtils.setFromAxis(tempQuat, v.x, v.y, v.z, angle);
  431.             MatrixUtils.createMatrix(objectMatrix, tempQuat, position);
  432.             //objectMatrix.setToRotation(new Vector3(0, 0, 1), normalizedDirection).setTranslation(position);
  433.            
  434.             Matrix4f.transform(viewMatrix, position, eyeSpacePosition);
  435.             Matrix3f.transform(rotationMatrix, normalizedDirection, eyeSpaceDirection);
  436.         }
  437.        
  438.         public void updateShadowResolution(int min, int max){
  439.            
  440.             float distance = Math.max(0, eyeSpacePosition.length() - intensity);
  441.            
  442.             requestedResolution = (int)ScalarUtils.clamp(renderTargets.getHeight() * intensity * shadowSystem.getResolutionMultiplier() / (cosineCutoff * distance), min, max);
  443.         }
  444.        
  445.         public void updateShadowMatrix(RenderView cameraView){
  446.            
  447.             target.set(
  448.                     position.x + normalizedDirection.x,
  449.                     position.y + normalizedDirection.y,
  450.                     position.z + normalizedDirection.z
  451.             );
  452.             up.set(0, 1, 0);
  453.             if(normalizedDirection.x == 0 && normalizedDirection.z == 0){
  454.                 up.set(0, 0, 1); //Ensure up is not equal to direction
  455.             }
  456.            
  457.             MatrixUtils.createLookAtMatrix(viewMatrix, new Vector3f(position), target, up);
  458.            
  459.             MatrixUtils.createPerspectiveMatrix(projectionMatrix, fov, 1, SHADOW_NEAR_PLANE, intensity);
  460.  
  461.             view.update(position.x, position.y, position.z, SHADOW_NEAR_PLANE, intensity);
  462.            
  463.             //inverseViewLightMatrix.set(projectionMatrix).mul(viewMatrix).mul(cameraView.getInverseViewMatrix());
  464.             Matrix4f.mul(projectionMatrix, viewMatrix, inverseViewLightMatrix);
  465.             Matrix4f.mul(inverseViewLightMatrix, cameraView.getInverseViewMatrix(), inverseViewLightMatrix);
  466.            
  467.            
  468.         }
  469.  
  470.         @Override
  471.         public int getWidth() {
  472.             return requestedResolution;
  473.         }
  474.  
  475.         @Override
  476.         public int getHeight() {
  477.             return requestedResolution;
  478.         }
  479.  
  480.         @Override
  481.         public void setOffset(int x, int y) {
  482.             this.x = x;
  483.             this.y = y;
  484.         }
  485.     }
  486.  
  487.     private abstract class ConeLightShader extends ShaderProgram{
  488.        
  489.         protected int screenSizeLocation;
  490.         protected int viewProjectionMatrixLocation;
  491.         protected int objectMatrixLocation;
  492.         protected int inverseProjectionMatrixLocation;
  493.  
  494.         protected int lightEyePositionLocation;
  495.         protected int lightEyeDirectionLocation;
  496.         protected int lightIntensityLocation;
  497.         protected int lightColorLocation;
  498.        
  499.         protected int cosineCutoffLocation;
  500.         protected int edgeDimmingLocation;
  501.        
  502.         protected int positionLocation;
  503.        
  504.         public ConeLightShader(String shaderPath, Shader... shaders) {
  505.             attachShader(new Shader(Shader.VERTEX_SHADER, new File(shaderPath + "light.vert")));
  506.             attachShader(new Shader(Shader.FRAGMENT_SHADER, new File(shaderPath + "light.frag")));
  507.             bindFragDataLocation(0, "light");
  508.             for(int i = 0; i < shaders.length; i++){
  509.                 attachShader(shaders[i]);
  510.             }
  511.             link();
  512.            
  513.             bind();
  514.            
  515.             glUniform1i(getUniformLocation("gBuffer0"), 0);
  516.             glUniform1i(getUniformLocation("gBuffer1"), 1);
  517.             glUniform1i(getUniformLocation("depthBuffer"), 2);
  518.            
  519.             screenSizeLocation = getUniformLocation("screenSize");
  520.             viewProjectionMatrixLocation = getUniformLocation("viewProjectionMatrix");
  521.             objectMatrixLocation = getUniformLocation("objectMatrix");
  522.             inverseProjectionMatrixLocation = getUniformLocation("inverseProjectionMatrix");
  523.  
  524.             lightEyePositionLocation = getUniformLocation("lightEyePosition");
  525.             lightEyeDirectionLocation = getUniformLocation("lightEyeDirection");
  526.             lightIntensityLocation = getUniformLocation("lightIntensity");
  527.             lightColorLocation = getUniformLocation("lightColor");
  528.            
  529.             cosineCutoffLocation = getUniformLocation("cosineCutoff");
  530.             edgeDimmingLocation = getUniformLocation("edgeDimming");
  531.            
  532.             positionLocation = getAttribLocation("position");
  533.         }
  534.        
  535.         public int createVAO(){
  536.            
  537.             int vao = glGenVertexArrays();
  538.             glBindVertexArray(vao);
  539.            
  540.             glBindBuffer(GL_ARRAY_BUFFER, vbo);
  541.             glEnableVertexAttribArray(positionLocation);
  542.             glVertexAttribPointer(positionLocation, 3, GL_FLOAT, false, 0, 0);
  543.             glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
  544.  
  545.             glBindVertexArray(0);
  546.            
  547.             return vao;
  548.         }
  549.     }
  550.    
  551.     private class UnshadowedShader extends ConeLightShader{
  552.  
  553.         public UnshadowedShader(String shaderPath) {
  554.             super(shaderPath, new Shader(Shader.FRAGMENT_SHADER, new File(shaderPath + "no shadows.frag")));
  555.         }
  556.        
  557.     }
  558.    
  559.     private class ShadowedShader extends ConeLightShader{
  560.        
  561.         private int inverseViewLightMatrixLocation;
  562.  
  563.         private int shadowOffsetLocation;
  564.         private int shadowResolutionLocation;
  565.  
  566.         public ShadowedShader(String shaderPath, Shader shadowSampleShader) {
  567.             super(shaderPath, new Shader(Shader.FRAGMENT_SHADER, new File(shaderPath + "shadows.frag")), shadowSampleShader);
  568.  
  569.             shadowSystem.uploadUniforms(this, 3);
  570.            
  571.             inverseViewLightMatrixLocation = getUniformLocation("inverseViewLightMatrix");
  572.            
  573.             shadowOffsetLocation = getUniformLocation("shadowOffset");
  574.             shadowResolutionLocation = getUniformLocation("shadowResolution");
  575.  
  576.         }
  577.     }
  578. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement