Esempio n. 1
0
 private CubeNode(IBufferSource model, params RenderMethodBuilder[] builders)
     : base(model, builders)
 {
 }
Esempio n. 2
0
 private SpotLightNode(IBufferSource model, string positionNameInIBufferSource, params RenderMethodBuilder[] builders)
     : base(model, positionNameInIBufferSource, builders)
 {
 }
Esempio n. 3
0
 /// <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;
 }
Esempio n. 4
0
        /// <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));
        }
Esempio n. 5
0
 private BackgroundNode(IBufferSource model, params RenderMethodBuilder[] builders)
     : base(model, builders)
 {
 }
Esempio n. 6
0
 private KleinBottleNode(IBufferSource model, string positionNameInIBufferSource, params RenderUnitBuilder[] builders)
     : base(model, positionNameInIBufferSource, builders)
 {
 }
Esempio n. 7
0
 private TextBillboardNode(ITextureSource textureSource, int width, int height, IBufferSource model, RenderUnitBuilder renderUnitBuilder)
     : base(model, renderUnitBuilder)
 {
     this.TextureSource = textureSource;
     this.Width         = width;
     this.Height        = height;
 }
Esempio n. 8
0
 private SimpleComputeNode(IBufferSource model, params RenderMethodBuilder[] builders)
     : base(model, builders)
 {
 }
Esempio n. 9
0
 private RaycastingNode(IBufferSource model, params RenderMethodBuilder[] builders)
     : base(model, builders)
 {
     this.CurrentMode = RenderMode.ISOSurface;
 }
Esempio n. 10
0
        // 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;
 }
Esempio n. 12
0
 private DemoNode(IBufferSource model, params RenderUnitBuilder[] builders)
     : base(model, builders)
 {
 }
Esempio n. 13
0
 /// <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];
 }
Esempio n. 14
0
 private TransparentPlaneNode(IBufferSource model, string positionNameInIBufferSource, params RenderMethodBuilder[] builders) : base(model, positionNameInIBufferSource, builders)
 {
 }