/// <summary>
        /// The render.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="flags">
        /// The flags.
        /// </param>
        /// <returns>
        /// The render.
        /// </returns>
        public override uint Render(CIwModel model, uint flags)
        {
            base.Render(model, flags);
            var verts = model.ResolveBlock<CIwModelBlockVerts>();
            var colors = model.ResolveBlock<CIwModelBlockCols>();
            var normals = model.ResolveBlock<CIwModelBlockNorms>();
            var uvs = model.ResolveBlock<CIwModelBlockGLUVs>();
            var uvs2 = model.ResolveBlock<CIwModelBlockGLUVs2>();
            if (verts != null)
            {
                foreach (var index in this.inds)
                {
                    if (colors != null)
                    {
                        GL.Color4(colors.Colors[index]);
                    }

                    if (normals != null)
                    {
                        GL.Normal3(normals.Normal[index]);
                    }

                    if (uvs != null)
                    {
                        GL.TexCoord2(uvs.UVs[index]);
                        GL.MultiTexCoord2(TextureUnit.Texture0, ref uvs.UVs[index]);
                    }

                    GL.Vertex3(verts.Verts[index]);
                }
            }

            return 0;
        }
        /// <summary>
        /// The render.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="flags">
        /// The flags.
        /// </param>
        /// <returns>
        /// The render.
        /// </returns>
        public override uint Render(CIwModel model, uint flags)
        {
            CIwMaterial material = model.GetMaterial(this.m_MaterialID);
            if (material != null)
            {
                material.Enable();
            }

            S3E.CheckOpenGLStatus();
            GL.Begin(BeginMode.Triangles);

            var verts = model.ResolveBlock<CIwModelBlockVerts>();
            var colors = model.ResolveBlock<CIwModelBlockCols>();
            var normals = model.ResolveBlock<CIwModelBlockNorms>();
            var indGroups = model.ResolveBlock<CIwModelBlockIndGroups>();

            if (verts != null)
            {
                foreach (var iwModelPrim in this.prims)
                {
                    iwModelPrim.Render(model, flags, verts, indGroups, colors);
                }
            }

            GL.End();
            if (material != null)
            {
                material.Disable();
            }

            S3E.CheckOpenGLStatus();

            return 0;
        }
        /// <summary>
        /// The render.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="flags">
        /// The flags.
        /// </param>
        /// <returns>
        /// The render.
        /// </returns>
        public override uint Render(CIwModel model, uint flags)
        {
            try
            {
                CIwMaterial material = model.GetMaterial(this.materialId);
                if (material != null)
                {
                    material.Enable();
                }

                S3E.CheckOpenGLStatus();
                GL.Begin(BeginMode.Triangles);
                base.Render(model, flags);
                GL.End();
                if (material != null)
                {
                    material.Disable();
                }

                S3E.CheckOpenGLStatus();
            }
            catch (Exception ex)
            {
                throw;
            }

            return 0;
        }
        /// <summary>
        /// The render.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="flags">
        /// The flags.
        /// </param>
        /// <returns>
        /// The render.
        /// </returns>
        public override uint Render(CIwModel model, uint flags)
        {
            CIwMaterial material = model.GetMaterial(this.materialId);
            if (material != null)
            {
                material.Enable();
            }

            GL.Begin(BeginMode.TriangleStrip);
            base.Render(model, flags);
            GL.End();
            S3E.CheckOpenGLStatus();

            if (material != null)
            {
                material.Disable();
            }

            return 0;
        }
Example #5
0
        /// <summary>
        /// The render.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="flags">
        /// The flags.
        /// </param>
        /// <param name="verts">
        /// The verts.
        /// </param>
        /// <param name="indGroups">
        /// The ind groups.
        /// </param>
        /// <param name="colors">
        /// The colors.
        /// </param>
        public void Render(
			CIwModel model, uint flags, CIwModelBlockVerts verts, CIwModelBlockIndGroups indGroups, CIwModelBlockCols colors)
        {
            if (0 == (this.m_Flags & IW_MODEL_PRIM_QUAD_F))
            {
                // Triangle
                this.RenderVertex(2, verts, indGroups, colors);
                this.RenderVertex(1, verts, indGroups, colors);
                this.RenderVertex(0, verts, indGroups, colors);
            }
            else
            {
                this.RenderVertex(3, verts, indGroups, colors);
                this.RenderVertex(1, verts, indGroups, colors);
                this.RenderVertex(0, verts, indGroups, colors);

                this.RenderVertex(2, verts, indGroups, colors);
                this.RenderVertex(3, verts, indGroups, colors);
                this.RenderVertex(0, verts, indGroups, colors);
            }
        }
Example #6
0
 //public ModelWriter(CMesh targetMesh)
 //{
 //    this.TargetMesh = targetMesh;
 //}
 public ModelWriter(CIwModel modelMesh)
 {
     this.modelMesh = modelMesh;
     if (modelMesh.ModelBlocks.Count > 0)
         TargetMesh = modelMesh.ModelBlocks[0];
 }
Example #7
0
 /// <summary>
 /// The render.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 /// <param name="flags">
 /// The flags.
 /// </param>
 /// <returns>
 /// The render.
 /// </returns>
 public virtual uint Render(CIwModel model, uint flags)
 {
     return 0;
 }