Hololens primitive model color has no effect

Hello all,

I am using UrhoSharp 1.3 and in the below code i am expecting a RED triangle whilst what i get is a grey one. I can get it colored only with model.SetMaterial(...).

Please advise.
Thanks,

Node node = Scene.CreateChild();
node.SetScale(0.5f);
StaticModel model = node.CreateComponent<StaticModel>();
model.Model = Triangle();
//model.SetMaterial(Material.FromColor(Color.Green));

private Model Triangle()
{
    PositionNormalColor[] vertexData =
    {
        new PositionNormalColor() {Color = Color.Red.ToUInt(), Position=new Vector3(-0.5f, 0.5f, 0.0f), Normal = new Vector3() },
        new PositionNormalColor() {Color = Color.Red.ToUInt(), Position=new Vector3(0.5f, 0.5f, 0.0f), Normal = new Vector3() },
        new PositionNormalColor() {Color = Color.Red.ToUInt(), Position=new Vector3(0.0f, -0.5f, 0.0f), Normal = new Vector3() },
    };

    uint numVertices = (uint)vertexData.Length;
    short[] indexData = { 0, 1, 2 };

    Model fromScratchModel = new Model();
    VertexBuffer vb = new VertexBuffer(Context, false);
    IndexBuffer ib = new IndexBuffer(Context, false);
    Geometry geom = new Geometry();

    vb.Shadowed = false;
    vb.SetSize(numVertices, ElementMask.Position | ElementMask.Normal | ElementMask.Color, false);
    vb.SetData(vertexData);

    ib.Shadowed = true;
    ib.SetSize(numVertices, false, false);
    ib.SetData(indexData);

    geom.SetVertexBuffer(0, vb);
    geom.IndexBuffer = ib;
    geom.SetDrawRange(PrimitiveType.TriangleList, 0, numVertices, true);

    fromScratchModel.NumGeometries = 1;
    fromScratchModel.SetGeometry(0, 0, geom);
    fromScratchModel.BoundingBox = new BoundingBox(0.0f, 0.5f);

    return fromScratchModel;
}
Sign In or Register to comment.