Added support for uniforms, textures and samplers.

This commit is contained in:
Areloch 2017-10-09 17:15:57 -05:00
parent 5019478aad
commit 74138342d1
7 changed files with 235 additions and 9 deletions

View file

@ -50,19 +50,32 @@ singleton Material(cube_GridMaterial)
mapTo = "GridMaterial";
CustomShaderFeature[0] = FlatColorFeature;
CustomShaderFeatureUniforms[FlatColorFeature,0] = "TestFloat";
};
//--- cube.dae MATERIALS END ---
//Voodoo!
function FlatColorFeature::processVert(%this)
function FlatColorFeature::processVertHLSL(%this)
{
}
function FlatColorFeature::processPixelHLSL(%this)
{
%this.writeLine(" float bobsyeruncle = 15.915;");
%this.addUniform("strudel", "float2");
%this.addSampler("strudelMap");
%this.addTexture("strudelTex", "Texture2D", "strudelMap");
%this.addVariable("bobsyeruncle", "float", 15.915);
%this.addVariable("chimmychanga", "float");
%this.writeLine(" @ = @ * 2;", "chimmychanga", "bobsyeruncle");
%this.writeLine(" @ *= @.x;", "bobsyeruncle", "strudel");
%this.writeLine(" @ *= @.y;", "chimmychanga", "strudel");
%this.addVariable("sprangle", "float4");
%this.writeLine(" @ = @.Sample(@,@);", "sprangle", "strudelTex", "strudelMap", "strudel");
}
function FlatColorFeature::setTextureResources(%this)