private SceneNodeBase GetRootNode() { var rootNode = new GroupNode(); { var axisNode = AxisNode.Create(); axisNode.Scale = new vec3(1, 1, 1) * 2; rootNode.Children.Add(axisNode); } { var cubeNode = CubeNode.Create(); rootNode.Children.Add(cubeNode); } { var groundNode = GroundNode.Create(); rootNode.Children.Add(groundNode); } return(rootNode); }
public static CubeNode Create() { // vertex buffer and index buffer. var model = new CubeModel(); // vertex shader and fragment shader. var vs = new VertexShader(vertexCode); var fs = new FragmentShader(fragmentCode); var array = new ShaderArray(vs, fs); // which vertex buffer maps to which attribute in shader. var map = new AttributeMap(); map.Add("inPosition", CubeModel.strPosition); // build a render method. var builder = new RenderMethodBuilder(array, map); // create node. var node = new CubeNode(model, builder); // initialize node. node.Initialize(); return(node); }