I create a simple cube like this:
function getCube(s3d, color:Int) {
var mat = Material.create();
mat.color.setColor(color);
var cube = new Cube(1, 1, 1);
cube.translate(0.5, 0.5, 0.5);
cube.unindex();
cube.addNormals();
var obj = new Mesh(cube, mat, s3d);
obj.material.mainPass.enableLights = true;
return obj;
}
Then I use it like this:
var box = getCube(s3d, 0x75a85b);
I have this shader (it does nothing):
class WallShader extends hxsl.shader.BaseMesh {
static var SRC = {
};
}
I enable the shader like this:
var box = getCube(s3d, 0x75a85b);
var shader:WallShader = new WallShader();
shader.id = Math.random();
box.material.mainPass.addShader(shader);
But then my cube looks like this:
Question: Why is that?
I suspect that extends BaseMesh
is cause of issue, but this contains lot of useful variables which I want to use (like input.position
and output.color
etc). What am I missing?