private CubeNode(IBufferSource model, params RenderMethodBuilder[] builders) : base(model, builders) { }
private SpotLightNode(IBufferSource model, string positionNameInIBufferSource, params RenderMethodBuilder[] builders) : base(model, positionNameInIBufferSource, builders) { }
/// <summary> /// Render propeller in legacy opengl. /// </summary> private LightPositionNode(IBufferSource model, string positionNameInIBufferable, params RenderMethodBuilder[] builders) : base(model, positionNameInIBufferable, builders) { this.ModelSize = new vec3(1, 1, 1) * 0.3f; this.AutoRotate = true; }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public RenderMethod ToRenderMethod(IBufferSource model) { // init shader program. ShaderProgram program = this.programProvider.GetShaderProgram(); // init vertex attribute buffer objects. var attrCount = this.map.Count(); // how many kinds of vertex attributes? var allBlocks = new List <VertexBuffer> [attrCount]; var allNames = new string[attrCount]; int blockCount = 0; // how many blocks an attribute is divided into? int index = 0; foreach (AttributeMap.NamePair item in this.map) { blockCount = 0; allBlocks[index] = new List <VertexBuffer>(); foreach (var buffer in model.GetVertexAttributeBuffer(item.NameInIBufferSource)) { if (buffer == null) { throw new Exception(string.Format("[{0}] returns null buffer pointer!", model)); } allBlocks[index].Add(buffer); allNames[index] = item.VarNameInShader; blockCount++; } if (blockCount != allBlocks[0].Count) { throw new Exception("Not all vertex attribute buffers' block count are the same!"); } index++; } // init draw commands. var drawCmds = (from item in model.GetDrawCommand() where (item != null) select item).ToArray(); int cmdCount = drawCmds.Length; if (attrCount > 0 && cmdCount != blockCount) { throw new Exception("Draw Commands count != vertex buffer block count."); } // init VAOs. var vaos = new VertexArrayObject[cmdCount]; for (int c = 0; c < cmdCount; c++) { var vertexShaderAttributes = new VertexShaderAttribute[attrCount]; for (int a = 0; a < attrCount; a++) { List <VertexBuffer> vertexAttribute = allBlocks[a]; string varNameInShader = allNames[a]; vertexShaderAttributes[a] = new VertexShaderAttribute(vertexAttribute[c], varNameInShader); } vaos[c] = new VertexArrayObject(drawCmds[c], program, vertexShaderAttributes); } return(new RenderMethod(program, vaos, this.switches)); }
private BackgroundNode(IBufferSource model, params RenderMethodBuilder[] builders) : base(model, builders) { }
private KleinBottleNode(IBufferSource model, string positionNameInIBufferSource, params RenderUnitBuilder[] builders) : base(model, positionNameInIBufferSource, builders) { }
private TextBillboardNode(ITextureSource textureSource, int width, int height, IBufferSource model, RenderUnitBuilder renderUnitBuilder) : base(model, renderUnitBuilder) { this.TextureSource = textureSource; this.Width = width; this.Height = height; }
private SimpleComputeNode(IBufferSource model, params RenderMethodBuilder[] builders) : base(model, builders) { }
private RaycastingNode(IBufferSource model, params RenderMethodBuilder[] builders) : base(model, builders) { this.CurrentMode = RenderMode.ISOSurface; }
// data structure for rendering. ///// <summary> ///// ///// </summary> //protected readonly RenderMethodBuilder[] builders; ///// <summary> ///// ///// </summary> //protected readonly IBufferSource model; /// <summary> /// Rendering something using GLSL shader and VBO(VAO). /// </summary> /// <param name="model">model data that can be transfermed into OpenGL Buffer's pointer.</param> ///<param name="builders">OpenGL switches.</param> public ModernNode(IBufferSource model, params RenderMethodBuilder[] builders) { this.RenderUnit = new ModernRenderUnit(model, builders); }
private FixedSizeQuadNode(IBufferSource model, params RenderMethodBuilder[] builders) : base(model, builders) { this.EnableRendering = ThreeFlags.BeforeChildren | ThreeFlags.Children; }
private DemoNode(IBufferSource model, params RenderUnitBuilder[] builders) : base(model, builders) { }
/// <summary> /// Rendering something using GLSL shader and VBO(VAO). /// </summary> /// <param name="model">model data that can be transfermed into OpenGL Buffer's pointer.</param> ///<param name="builders">OpenGL switches.</param> public ModernRenderUnit(IBufferSource model, params RenderMethodBuilder[] builders) { this.Model = model; this.builders = builders; this.Methods = new RenderMethod[builders.Length]; }
private TransparentPlaneNode(IBufferSource model, string positionNameInIBufferSource, params RenderMethodBuilder[] builders) : base(model, positionNameInIBufferSource, builders) { }