当前位置: 首页>>代码示例>>C#>>正文


C# RenderFlags.HasFlag方法代码示例

本文整理汇总了C#中RenderFlags.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# RenderFlags.HasFlag方法的具体用法?C# RenderFlags.HasFlag怎么用?C# RenderFlags.HasFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderFlags的用法示例。


在下文中一共展示了RenderFlags.HasFlag方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        /// <summary>
        /// <see cref="ISceneRenderer.Render"/>
        /// </summary>   
        public void Render(ICameraController cam, Dictionary<Node, List<Mesh>> visibleMeshesByNode,
            bool visibleSetChanged,
            bool texturesChanged,
            RenderFlags flags, 
            Renderer renderer)
        {
            GL.Disable(EnableCap.Texture2D);
            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);
            GL.Enable(EnableCap.DepthTest);
            GL.FrontFace(FrontFaceDirection.Ccw);

            if (flags.HasFlag(RenderFlags.Wireframe))
            {
                GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
            }

            // If textures changed, we may need to upload some of them to VRAM.
            if (texturesChanged)
            {
                UploadTextures();
            }

            GL.MatrixMode(MatrixMode.Modelview);
            var view = cam == null ? Matrix4.LookAt(0, 10, 5, 0, 0, 0, 0, 1, 0) : cam.GetView();

            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadMatrix(ref view);

            var tmp = InitposeMax.X - InitposeMin.X;
            tmp = Math.Max(InitposeMax.Y - InitposeMin.Y, tmp);
            tmp = Math.Max(InitposeMax.Z - InitposeMin.Z, tmp);
            tmp = 2.0f / tmp;

            var world = Matrix4.Scale(tmp);
            world *= Matrix4.CreateTranslation(-(InitposeMin + InitposeMax) * 0.5f);
            PushWorld(ref world);
            //
            var animated = Owner.SceneAnimator.IsAnimationActive;
            var needAlpha = RecursiveRender(Owner.Raw.RootNode, visibleMeshesByNode, flags, animated);
            if (flags.HasFlag(RenderFlags.ShowSkeleton) || flags.HasFlag(RenderFlags.ShowNormals))
            {
                //RecursiveRenderNoScale(Owner.Raw.RootNode, visibleMeshesByNode, flags, 1.0f / tmp, animated);
            }

            if (needAlpha)
            {
                // handle semi-transparent geometry
                RecursiveRenderWithAlpha(Owner.Raw.RootNode, visibleMeshesByNode, flags, animated);
            }
            PopWorld();

            // always switch back to FILL
            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);

            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.Texture2D);
            GL.Disable(EnableCap.Lighting);
        }
开发者ID:acgessler,项目名称:open3mod,代码行数:61,代码来源:SceneRendererModernGl.cs

示例2: Render

        /// <summary>
        /// Draws the mesh geometry given the current pipeline state. 
        /// 
        /// The pipeline is restored afterwards.
        /// </summary>
        /// <param name="flags">Rendering mode</param>
        public void Render(RenderFlags flags)
        {
            GL.PushClientAttrib(ClientAttribMask.ClientVertexArrayBit);

            Debug.Assert(_vbo.VertexBufferId != 0);
            Debug.Assert(_vbo.ElementBufferId != 0);

            // normals
            if (flags.HasFlag(RenderFlags.Shaded))
            {
                if (_vbo.NormalBufferId != 0)
                {
                    GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo.NormalBufferId);
                    GL.NormalPointer(NormalPointerType.Float, Vector3.SizeInBytes, IntPtr.Zero);
                    GL.EnableClientState(ArrayCap.NormalArray);
                }
            }

            // vertex colors
            if (_vbo.ColorBufferId != 0)
            {
                GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo.ColorBufferId);
                GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(int), IntPtr.Zero);
                GL.EnableClientState(ArrayCap.ColorArray);
            }

            // UV coordinates
            if (flags.HasFlag(RenderFlags.Textured))
            {
                if (_vbo.TexCoordBufferId != 0)
                {
                    GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo.TexCoordBufferId);
                    GL.TexCoordPointer(2, TexCoordPointerType.Float, 8, IntPtr.Zero);
                    GL.EnableClientState(ArrayCap.TextureCoordArray);
                }
            }


            // vertex position
            GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo.VertexBufferId);
            GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes, IntPtr.Zero);
            GL.EnableClientState(ArrayCap.VertexArray);


            // primitives
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, _vbo.ElementBufferId);
            GL.DrawElements(BeginMode.Triangles, _vbo.NumIndices /* actually, count(indices) */,
                _vbo.Is32BitIndices ? DrawElementsType.UnsignedInt : DrawElementsType.UnsignedShort,
                IntPtr.Zero);

            // Restore the state
            GL.PopClientAttrib();
        }
开发者ID:Kolky,项目名称:open3mod,代码行数:59,代码来源:RenderMesh.cs

示例3: RenderPart

        void RenderPart(Part part, RenderFlags renderFlags)
        {
            GL.Material(MaterialFace.Front, MaterialParameter.Diffuse, shaders[part.ShaderIndex].Tint.ToColor4());
            var batch = batches[part.BatchIndex];

            if (batch.UseNBT) // Render with bump map.
            {
                int binormalAttribute = GL.GetAttribLocation(Program.EmbossProgram, "inBinormal");
                int tangentAttribute = GL.GetAttribLocation(Program.EmbossProgram, "inTangent");
                int diffuseMap = GL.GetUniformLocation(Program.EmbossProgram, "diffuseMap");
                int bumpMap = GL.GetUniformLocation(Program.EmbossProgram, "bumpMap");
                int embossFactor = GL.GetUniformLocation(Program.EmbossProgram, "embossScale");

                Program.EmbossProgram.Use();

                GL.ActiveTexture(TextureUnit.Texture0 + 0);
                GL.Enable(EnableCap.Texture2D);
                GL.BindTexture(TextureTarget.Texture2D, glTextures[materials[shaders[part.ShaderIndex].MaterialIndex[0]].textureIndex]);
                GLUtility.SetTexture2DWrapModeS(materials[shaders[part.ShaderIndex].MaterialIndex[0]].wrapS);
                GLUtility.SetTexture2DWrapModeT(materials[shaders[part.ShaderIndex].MaterialIndex[0]].wrapT);
                GL.Uniform1(diffuseMap, 0);

                GL.ActiveTexture(TextureUnit.Texture0 + 1);
                GL.Enable(EnableCap.Texture2D);
                GL.BindTexture(TextureTarget.Texture2D, glTextures[materials[shaders[part.ShaderIndex].MaterialIndex[1]].textureIndex]);
                GLUtility.SetTexture2DWrapModeS(materials[shaders[part.ShaderIndex].MaterialIndex[1]].wrapS);
                GLUtility.SetTexture2DWrapModeT(materials[shaders[part.ShaderIndex].MaterialIndex[1]].wrapT);
                GL.Uniform1(bumpMap, 1);

                GL.Uniform1(embossFactor, 2.0f);

                foreach (var primitive in batch)
                {
                    GL.Begin(primitive.GLType);

                    foreach (var vertex in primitive)
                    {
                        GL.MultiTexCoord2(TextureUnit.Texture0 + 0, ref texCoord0s[vertex.UVIndex[0].Value]);
                        GL.MultiTexCoord2(TextureUnit.Texture0 + 1, ref texCoord1s[vertex.UVIndex[1].Value]);
                        GL.Normal3(normals[vertex.NormalIndex.Value]);
                        GL.VertexAttrib3(tangentAttribute, ref normals[vertex.BinormalIndex.Value + 1]);
                        GL.VertexAttrib3(binormalAttribute, ref normals[vertex.TangentIndex.Value + 2]);
                        GL.Vertex3(positions[vertex.PositionIndex.Value]);
                    }

                    GL.End();
                }

                GL.UseProgram(0);
            }
            else // Render without bump map.
            {
                for (int texUnit = 0; texUnit < 8; texUnit++)
                {
                    if (shaders[part.ShaderIndex].MaterialIndex[texUnit] < 0)
                    {
                        continue;
                    }

                    var material = materials[shaders[part.ShaderIndex].MaterialIndex[texUnit]];
                    GL.ActiveTexture(TextureUnit.Texture0 + texUnit);
                    GL.Enable(EnableCap.Texture2D);
                    GL.BindTexture(TextureTarget.Texture2D, glTextures[material.textureIndex]);
                    GLUtility.SetTexture2DWrapModeS(material.wrapS);
                    GLUtility.SetTexture2DWrapModeT(material.wrapT);
                }

                foreach (var primitive in batch)
                {
                    GL.Begin(primitive.GLType);

                    foreach (var vertex in primitive)
                    {
                        if (vertex.UVIndex[0] != null)
                        {
                            GL.MultiTexCoord2(TextureUnit.Texture0, ref texCoord0s[vertex.UVIndex[0].Value]);
                        }

                        if (vertex.NormalIndex != null)
                        {
                            GL.Normal3(normals[vertex.NormalIndex.Value]);
                        }

                        GL.Vertex3(positions[vertex.PositionIndex.Value]);
                    }

                    GL.End();
                }
            }

            GLUtility.DisableTexture2D();

            // normals
            if (renderFlags.HasFlag(RenderFlags.NBT))
            {
                const float normalLength = 0.0625f;

                GL.Disable(EnableCap.Lighting);
                GL.Begin(BeginMode.Lines);

//.........这里部分代码省略.........
开发者ID:arookas,项目名称:Demolisher,代码行数:101,代码来源:Bin.cs

示例4: RenderGraphObject

        void RenderGraphObject(GraphObject graphObject, RenderFlags renderFlags)
        {
            // visibility check
            if (!graphObject.Visible)
            {
                return;
            }

            // render-flag check
            if (!renderFlags.HasFlag(RenderFlags.Ceilings) && graphObject.HasRenderFlag(GraphObjectRenderFlags.Ceiling))
            {
                return;
            }
            if (!renderFlags.HasFlag(RenderFlags.FourthWalls) && graphObject.HasRenderFlag(GraphObjectRenderFlags.FourthWall))
            {
                return;
            }

            // matrix transformations
            GL.PushMatrix();
            TransformMatrix(graphObject.Position, graphObject.Rotation, graphObject.Scale);

            // bounding box
            if (renderFlags.HasFlag(RenderFlags.BoundingBox))
            {
                GL.Disable(EnableCap.Lighting);
                GL.Disable(EnableCap.Texture2D);
                GL.Color3(Color.Yellow);
                GLUtility.WireCube(graphObject.BoundingBox * GlobalScaleReciprocal);
                GL.Color3(Color.White);
                GL.Enable(EnableCap.Texture2D);
                GL.Enable(EnableCap.Lighting);
            }

            if (graphObject.HasRenderFlag(GraphObjectRenderFlags.FullBright))
            {
                GL.Disable(EnableCap.Lighting);
            }

            // Render parts.
            foreach (var part in graphObject)
            {
                if (shaders[part.ShaderIndex].Tint.A > 0 && ((shaders[part.ShaderIndex].Tint.A == Color.Opaque && renderFlags.HasFlag(RenderFlags.Opaque)) || (shaders[part.ShaderIndex].Tint.A < Color.Opaque && renderFlags.HasFlag(RenderFlags.Translucent))))
                {
                    RenderPart(part, renderFlags);
                }
            }

            GL.Enable(EnableCap.Lighting);

            // Render children.
            for (int childIndex = graphObject.ChildIndex; childIndex >= 0; childIndex = graphObjects[childIndex].NextIndex)
            {
                RenderGraphObject(graphObjects[childIndex], renderFlags);
            }

            GL.PopMatrix();
        }
开发者ID:arookas,项目名称:Demolisher,代码行数:58,代码来源:Bin.cs

示例5: Render

        /// <summary>
        /// <see cref="ISceneRenderer.Render"/>
        /// </summary>   
        public void Render(ICameraController cam, Dictionary<Node, List<Mesh>> visibleMeshesByNode, 
            bool visibleSetChanged, 
            bool texturesChanged,
            RenderFlags flags, 
            Renderer renderer)
        {            
            GL.Disable(EnableCap.Texture2D);
            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);
            GL.Enable(EnableCap.DepthTest);

            // set fixed-function lighting parameters
            GL.ShadeModel(ShadingModel.Smooth);
            GL.LightModel(LightModelParameter.LightModelAmbient, new[] { 0.3f, 0.3f, 0.3f, 1 });
            GL.Enable(EnableCap.Lighting);
            GL.Enable(EnableCap.Light0);

           
            if (flags.HasFlag(RenderFlags.Wireframe))
            {
                GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
            }

            var tmp = InitposeMax.X - InitposeMin.X;
            tmp = Math.Max(InitposeMax.Y - InitposeMin.Y, tmp);
            tmp = Math.Max(InitposeMax.Z - InitposeMin.Z, tmp);
            var scale = 2.0f / tmp;     

            // TODO: migrate general scale and this snippet to camcontroller code
            if (cam != null)
            {
                cam.SetPivot(Owner.Pivot * (float)scale);
            }
            var view = cam == null ? Matrix4.LookAt(0, 10, 5, 0, 0, 0, 0, 1, 0) : cam.GetView();

            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadMatrix(ref view);

            // light direction
            var dir = new Vector3(1, 1, 0);
            var mat = renderer.LightRotation;
            Vector3.TransformNormal(ref dir, ref mat, out dir);
            GL.Light(LightName.Light0, LightParameter.Position, new float[] { dir.X, dir.Y, dir.Z, 0 });

            // light color
            var col = new Vector3(1, 1, 1);
            col *= (0.25f + 1.5f * GraphicsSettings.Default.OutputBrightness / 100.0f) * 1.5f;

            GL.Light(LightName.Light0, LightParameter.Diffuse, new float[] { col.X, col.Y, col.Z, 1 });
            GL.Light(LightName.Light0, LightParameter.Specular, new float[] { col.X, col.Y, col.Z, 1 });

            if (flags.HasFlag(RenderFlags.Shaded))
            {
                OverlayLightSource.DrawLightSource(dir);
            }

           
            GL.Scale(scale, scale, scale);


            // If textures changed, we may need to upload some of them to VRAM.
            // it is important this happens here and not accidentially while
            // compiling a displist.
            if (texturesChanged)
            {
                UploadTextures();
            }

            GL.PushMatrix();

            // Build and cache Gl displaylists and update only when the scene changes.
            // when the scene is being animated, this is bad because it changes every
            // frame anyway. In this case  we don't use a displist.
            var animated = Owner.SceneAnimator.IsAnimationActive;
            if (_displayList == 0 || visibleSetChanged || texturesChanged || flags != _lastFlags || animated)
            {
                _lastFlags = flags;

                // handle opaque geometry
                if (!animated)
                {
                    if (_displayList == 0)
                    {
                        _displayList = GL.GenLists(1);
                    }
                    
                    GL.NewList(_displayList, ListMode.Compile);
                }
                
                var needAlpha = RecursiveRender(Owner.Raw.RootNode, visibleMeshesByNode, flags, animated);

                if (flags.HasFlag(RenderFlags.ShowSkeleton))
                {
                    RecursiveRenderNoScale(Owner.Raw.RootNode, visibleMeshesByNode, flags, 1.0f / scale, animated);
                }
                if (flags.HasFlag(RenderFlags.ShowNormals))
                {
                    RecursiveRenderNormals(Owner.Raw.RootNode, visibleMeshesByNode, flags, 1.0f / scale, animated, Matrix4.Identity);
//.........这里部分代码省略.........
开发者ID:Kolky,项目名称:open3mod,代码行数:101,代码来源:SceneRendererClassicGl.cs

示例6: RecursiveRenderNormals

        /// <summary>
        /// Recursive render function for drawing normals with a constant size.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="visibleMeshesByNode"></param>
        /// <param name="flags"></param>
        /// <param name="invGlobalScale"></param>
        /// <param name="animated"></param>
        /// <param name="transform"></param>
        private void RecursiveRenderNormals(Node node, Dictionary<Node, List<Mesh>> visibleMeshesByNode, RenderFlags flags,
            float invGlobalScale,
            bool animated,
            Matrix4 transform)
        {
            // TODO unify our use of OpenTK and Assimp matrices
            Matrix4 mConv;
            if (animated)
            {
                Owner.SceneAnimator.GetLocalTransform(node, out mConv);
            }
            else
            {
                Matrix4x4 m = node.Transform;
                mConv = AssimpToOpenTk.FromMatrix(ref m);
            }

            mConv.Transpose();

            // The normal's position and direction are transformed differently, so we manually track the transform.
            transform = mConv * transform;

            if (flags.HasFlag(RenderFlags.ShowNormals))
            {
                List<Mesh> meshList = null;
                if (node.HasMeshes &&
                    (visibleMeshesByNode == null || visibleMeshesByNode.TryGetValue(node, out meshList)))
                {
                    foreach (var index in node.MeshIndices)
                    {
                        var mesh = Owner.Raw.Meshes[index];
                        if (meshList != null && !meshList.Contains(mesh))
                        {
                            continue;
                        }

                        OverlayNormals.DrawNormals(node, index, mesh, mesh.HasBones && animated ? Skinner : null, invGlobalScale, transform);
                    }
                }
            }

            for (int i = 0; i < node.ChildCount; i++)
            {
                RecursiveRenderNormals(node.Children[i], visibleMeshesByNode, flags, invGlobalScale, animated, transform);
            }
        }
开发者ID:Kolky,项目名称:open3mod,代码行数:55,代码来源:SceneRendererClassicGl.cs

示例7: RecursiveRenderNoScale

        /// <summary>
        /// Recursive render function for drawing opaque geometry with no scaling 
        /// in the transformation chain. This is used for overlays, such as drawing
        /// the skeleton.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="visibleMeshesByNode"></param>
        /// <param name="flags"></param>
        /// <param name="invGlobalScale"></param>
        /// <param name="animated"></param>
        private void RecursiveRenderNoScale(Node node, Dictionary<Node, List<Mesh>> visibleMeshesByNode, RenderFlags flags, 
            float invGlobalScale,
            bool animated)
        {
            // TODO unify our use of OpenTK and Assimp matrices 
            Matrix4x4 m;
            Matrix4 mConv;
            if (animated)
            {
                Owner.SceneAnimator.GetLocalTransform(node, out mConv);
                OpenTkToAssimp.FromMatrix(ref mConv, out m);
            }
            else
            {
                m = node.Transform;
            }
            
            // get rid of the scaling part of the matrix
            // TODO this can be done faster and Decompose() doesn't handle
            // non positively semi-definite matrices correctly anyway.

            Vector3D scaling;
            Assimp.Quaternion rotation;
            Vector3D translation;
            m.Decompose(out scaling, out rotation, out translation);

            rotation.Normalize();

            m = new Matrix4x4(rotation.GetMatrix()) * Matrix4x4.FromTranslation(translation);
            mConv = AssimpToOpenTk.FromMatrix(ref m);
            mConv.Transpose();

            if (flags.HasFlag(RenderFlags.ShowSkeleton))
            {           
                var highlight = false;
                if (visibleMeshesByNode != null)
                {
                    List<Mesh> meshList;
                    if (visibleMeshesByNode.TryGetValue(node, out meshList) && meshList == null)
                    {
                        // If the user hovers over a node in the tab view, all of its descendants
                        // are added to the visible set as well. This is not the intended 
                        // behavior for skeleton joints, though! Here we only want to show the
                        // joint corresponding to the node being hovered over.

                        // Therefore, only highlight nodes whose parents either don't exist
                        // or are not in the visible set.
                        if (node.Parent == null || !visibleMeshesByNode.TryGetValue(node.Parent, out meshList) || meshList != null)
                        {
                            highlight = true;
                        }
                    }
                }
                OverlaySkeleton.DrawSkeletonBone(node, invGlobalScale,highlight);
            }

            GL.PushMatrix();
            GL.MultMatrix(ref mConv);
            for (int i = 0; i < node.ChildCount; i++)
            {
                RecursiveRenderNoScale(node.Children[i], visibleMeshesByNode, flags, invGlobalScale, animated);
            }
            GL.PopMatrix();
        }
开发者ID:Kolky,项目名称:open3mod,代码行数:74,代码来源:SceneRendererClassicGl.cs

示例8: InternDrawMesh

        /// <summary>
        /// Draw a mesh using either its given material or a transparent "ghost" material.
        /// </summary>
        /// <param name="node">Current node</param>
        /// <param name="animated">Specifies whether animations should be played</param>
        /// <param name="showGhost">Indicates whether to substitute the mesh' material with a
        /// "ghost" surrogate material that allows looking through the geometry.</param>
        /// <param name="index">Mesh index in the scene</param>
        /// <param name="mesh">Mesh instance</param>
        /// <param name="flags"> </param>
        /// <returns></returns>
        protected override bool InternDrawMesh(Node node, bool animated, bool showGhost, int index, Mesh mesh, RenderFlags flags)
        {
            if (showGhost)
            {
                Owner.MaterialMapper.ApplyGhostMaterial(mesh, Owner.Raw.Materials[mesh.MaterialIndex], 
                    flags.HasFlag(RenderFlags.Shaded));
            }
            else
            {
                Owner.MaterialMapper.ApplyMaterial(mesh, Owner.Raw.Materials[mesh.MaterialIndex], 
                    flags.HasFlag(RenderFlags.Textured), 
                    flags.HasFlag(RenderFlags.Shaded));
            }

            if (GraphicsSettings.Default.BackFaceCulling)
            {
                GL.FrontFace(FrontFaceDirection.Ccw);
                GL.CullFace(CullFaceMode.Back);
                GL.Enable(EnableCap.CullFace);
            }
            else
            {
                GL.Disable(EnableCap.CullFace);
            }

            var hasColors = mesh.HasVertexColors(0);
            var hasTexCoords = mesh.HasTextureCoords(0);

            var skinning = mesh.HasBones && animated;

            foreach (var face in mesh.Faces)
            {
                BeginMode faceMode;
                switch (face.IndexCount)
                {
                    case 1:
                        faceMode = BeginMode.Points;
                        break;
                    case 2:
                        faceMode = BeginMode.Lines;
                        break;
                    case 3:
                        faceMode = BeginMode.Triangles;
                        break;
                    default:
                        faceMode = BeginMode.Polygon;
                        break;
                }

                GL.Begin(faceMode);
                for (var i = 0; i < face.IndexCount; i++)
                {
                    var indice = face.Indices[i];
                    if (hasColors)
                    {
                        var vertColor = AssimpToOpenTk.FromColor(mesh.VertexColorChannels[0][indice]);
                        GL.Color4(vertColor);
                    }
                    if (mesh.HasNormals)
                    {
                        Vector3 normal;
                        if (skinning)
                        {
                            Skinner.GetTransformedVertexNormal(node, mesh, (uint)indice, out normal);
                        }
                        else
                        {
                            normal = AssimpToOpenTk.FromVector(mesh.Normals[indice]);
                        }

                        GL.Normal3(normal);
                    }
                    if (hasTexCoords)
                    {
                        var uvw = AssimpToOpenTk.FromVector(mesh.TextureCoordinateChannels[0][indice]);
                        GL.TexCoord2(uvw.X, 1 - uvw.Y);
                    }

                    Vector3 pos;
                    if (skinning)
                    {
                        Skinner.GetTransformedVertexPosition(node, mesh, (uint)indice, out pos);
                    }
                    else
                    {
                        pos = AssimpToOpenTk.FromVector(mesh.Vertices[indice]);
                    }
                    GL.Vertex3(pos);
                }
//.........这里部分代码省略.........
开发者ID:Kolky,项目名称:open3mod,代码行数:101,代码来源:SceneRendererClassicGl.cs

示例9: EnumFunc

 void EnumFunc(PipelineState p, RenderFlags f)
 {
     p.BlendState			= BlendState.Opaque;
     p.DepthStencilState		= DepthStencilState.Default;
     p.Primitive				= Primitive.PatchList3CP;
     p.VertexInputElements	= VertexColorTextureTBN.Elements;
     p.RasterizerState		= f.HasFlag(RenderFlags.Wireframe) ? RasterizerState.Wireframe : RasterizerState.CullCW;
 }
开发者ID:temik911,项目名称:audio,代码行数:8,代码来源:TriPlanarMappingDemo.cs

示例10: DrawOpaqueMeshes

        /// <summary>
        /// Draw the opaque (i.e. not semi-transparent) meshes pertaining to a node
        /// and checks whether the node has any semi-transparent meshes to be drawn later.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="visibleMeshesByNode"></param>
        /// <param name="flags"></param>
        /// <param name="animated"></param>
        /// <returns>Whether there were any meshes skipped because they are not opaque</returns>
        protected bool DrawOpaqueMeshes(Node node, Dictionary<Node, List<Mesh>> visibleMeshesByNode, 
            RenderFlags flags, 
            bool animated)
        {
            // the following permutations could be compacted into one big loop with lots of
            // condition magic, but at the cost of readability and also performance.
            // we therefore keep it redundant and stupid.
            var needAlpha = false;
            if (visibleMeshesByNode == null)
            {
                // everything is visible. alpha-blended materials are delayed for 2nd pass
                foreach (var index in node.MeshIndices)
                {
                    var mesh = Owner.Raw.Meshes[index];
                    if (IsAlphaMaterial[mesh.MaterialIndex])
                    {
                        needAlpha = true;
                        continue;
                    }

                    var skinning = DrawMesh(node, animated, false, index, mesh, flags);
                    if (flags.HasFlag(RenderFlags.ShowBoundingBoxes))
                    {
                        OverlayBoundingBox.DrawBoundingBox(node, index, mesh, skinning ? Skinner : null);
                    }
                }
            }
            else
            {
                List<Mesh> meshList;
                if (visibleMeshesByNode.TryGetValue(node, out meshList))
                {
                    // some meshes of this node are visible. alpha-blended materials are delayed for 2nd pass
                    foreach (var index in node.MeshIndices)
                    {
                        var mesh = Owner.Raw.Meshes[index];

                        if (IsAlphaMaterial[mesh.MaterialIndex] || (meshList != null && !meshList.Contains(mesh)))
                        {
                            needAlpha = true;
                            continue;
                        }

                        var skinning = DrawMesh(node, animated, false, index, mesh, flags);
                        if (flags.HasFlag(RenderFlags.ShowBoundingBoxes))
                        {
                            OverlayBoundingBox.DrawBoundingBox(node, index, mesh, skinning ? Skinner : null);
                        }
                    }
                }
                else
                {
                    // node not visible, draw ghosts in 2nd pass
                    needAlpha = true;
                }
            }
            return needAlpha;
        }
开发者ID:Kolky,项目名称:open3mod,代码行数:67,代码来源:SceneRendererShared.cs

示例11: InternDrawMesh

        protected override bool InternDrawMesh(Node node, bool animated, bool showGhost, int index, Mesh mesh, RenderFlags flags)
        {
            if (_meshes[index] == null) {
                _meshes[index] = new RenderMesh(mesh);
            }

            if (showGhost)
            {
                Owner.MaterialMapper.ApplyGhostMaterial(mesh, Owner.Raw.Materials[mesh.MaterialIndex],
                    flags.HasFlag(RenderFlags.Shaded));
            }
            else
            {
                Owner.MaterialMapper.ApplyMaterial(mesh, Owner.Raw.Materials[mesh.MaterialIndex],
                    flags.HasFlag(RenderFlags.Textured),
                    flags.HasFlag(RenderFlags.Shaded));
            }

            if (GraphicsSettings.Default.BackFaceCulling)
            {
                GL.FrontFace(FrontFaceDirection.Ccw);
                GL.CullFace(CullFaceMode.Back);
                GL.Enable(EnableCap.CullFace);
            }
            else
            {
                GL.Disable(EnableCap.CullFace);
            }

            _meshes[index].Render(flags);
            return true;
        }
开发者ID:acgessler,项目名称:open3mod,代码行数:32,代码来源:SceneRendererModernGl.cs

示例12: Enum

        void Enum( PipelineState plState, RenderFlags flag )
        {
            plState.RasterizerState		= RasterizerState.CullNone;
                plState.BlendState			= BlendMode;
                plState.DepthStencilState	= DepthStencilState.Default;
                plState.Primitive			= Primitive.PointList;

                if (flag.HasFlag(RenderFlags.LINE))
                {
                    //plState.BlendState = BlendState.Screen;
                    //plState.DepthStencilState = DepthStencilState.Readonly;
                }
        }
开发者ID:mukhinaks,项目名称:proteins,代码行数:13,代码来源:GraphSystem.cs


注:本文中的RenderFlags.HasFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。