Example #1
0
            public bool validate(BaseShader shader, int inputID, Renderable renderable)
            {
                long matFlags = (renderable != null && renderable.material != null) ? renderable.material.getMask() : 0;
                long envFlags = (renderable != null && renderable.environment != null) ? renderable.environment.getMask() : 0;

                return(((matFlags & materialMask) == materialMask) && ((envFlags & environmentMask) == environmentMask) &&
                       (((matFlags | envFlags) & overallMask) == overallMask));
            }
Example #2
0
 public override void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes)
 {
     // todo: figure out this
     //for (int i = 0; i < bones.Length; i++)
     //{
     //    int idx = i / 16;
     //    bones[i] = (renderable.bones == null || idx >= renderable.bones.Length || renderable.bones[idx] == null)
     //        ? idtMatrix.val[i % 16]
     //        : renderable.bones[idx].val[i % 16];
     //}
     //shader.program.setUniformMatrix(shader.loc(inputID), bones, 0, bones.Length);
 }
Example #3
0
                public override void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes)
                {
                    if (renderable.environment == null)
                    {
                        shader.program.setUniform3fv(shader.loc(inputID), ones);
                    }
                    else
                    {
                        // todo: double check
                        var tmpV1 = renderable.worldTransform.ExtractTranslation();
                        if (combinedAttributes.has(ColorAttribute.AmbientLight))
                        {
                            cacheAmbientCubemap.set(((ColorAttribute)combinedAttributes.get(ColorAttribute.AmbientLight)).color);
                        }

                        if (combinedAttributes.has(DirectionalLightsAttribute.Type))
                        {
                            var lights = combinedAttributes.get <DirectionalLightsAttribute>(DirectionalLightsAttribute.Type).lights;
                            for (int i = dirLightsOffset; i < lights.Count; i++)
                            {
                                cacheAmbientCubemap.add(lights[i].color, lights[i].direction);
                            }
                        }

                        if (combinedAttributes.has(PointLightsAttribute.Type))
                        {
                            var lights = (combinedAttributes.get <PointLightsAttribute>(PointLightsAttribute.Type)).lights;
                            for (int i = pointLightsOffset; i < lights.Count; i++)
                            {
                                cacheAmbientCubemap.add(lights[i].color, lights[i].position, tmpV1, lights[i].intensity);
                            }
                        }

                        cacheAmbientCubemap.clamp();
                        shader.program.setUniform3fv(shader.loc(inputID), cacheAmbientCubemap.data);
                    }
                }
Example #4
0
 public override void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes)
 {
     cb?.Invoke(shader, inputID, renderable, combinedAttributes);
 }
Example #5
0
 public abstract void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes);
Example #6
0
 public bool isGlobal(BaseShader shader, int inputID)
 {
     return(false);
 }