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


C# RenderFlags类代码示例

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


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

示例1: MyLodMeshMerge

            internal MyLodMeshMerge(MyClipmap parentClipmap, int lod, int lodDivisions, ref MatrixD worldMatrix, ref Vector3D massiveCenter, float massiveRadius, RenderFlags renderFlags)
            {
                Debug.Assert(parentClipmap != null, "Parent clipmap cannot be null");
                Debug.Assert(lod >= 0, "Lod level must be non-negative");
                Debug.Assert(lodDivisions >= 0, "Invalid number of lod divisions");
                m_parentClipmap = parentClipmap;
                m_lod = lod;
                m_lodDivisions = lodDivisions;

                if (m_lodDivisions <= 0)
                    return;

                m_dirtyProxyIndices = new HashSet<int>();
                m_cellProxyToAabbProxy = new Dictionary<MyClipmapCellProxy, int>();
                m_boundingBoxes = new MyDynamicAABBTreeD(Vector3D.Zero);

                int cellCount = lodDivisions*lodDivisions*lodDivisions;
                m_mergeJobs = new MergeJobInfo[cellCount];
                m_mergedLodMeshProxies = new MyClipmapCellProxy[cellCount];
                m_trackedActors = new HashSet<MyActor>[cellCount];

                for (int divideIndex = 0; divideIndex < cellCount; ++divideIndex)
                {
                    m_mergedLodMeshProxies[divideIndex] = new MyClipmapCellProxy(new MyCellCoord(Lod, GetCellFromDivideIndex(divideIndex)), ref worldMatrix, massiveCenter, massiveRadius, renderFlags, true);
                    m_mergeJobs[divideIndex] = new MergeJobInfo { CurrentWorkId = 0, LodMeshesBeingMerged = new List<LodMeshId>(), NextPossibleMergeStartTime = MyCommon.FrameCounter };
                    m_trackedActors[divideIndex] = new HashSet<MyActor>();
                    m_dirtyProxyIndices.Add(divideIndex);
                }
            }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:29,代码来源:MyLodMeshMergeHandler.cs

示例2: MyClipmapHandler

        internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, RenderFlags additionalFlags)
        {
            m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this);
            m_renderFlags = additionalFlags;

            MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, m_clipmapBase);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyClipmapHandler.cs

示例3: MyRenderAtmosphere

 public MyRenderAtmosphere(uint id, string debugName, string model, MatrixD worldMatrix, MyMeshDrawTechnique drawTechnique, RenderFlags renderFlags, float atmosphereRadius, float planetRadius, Vector3 atmosphereWavelengths)
     : base(id, debugName,model, worldMatrix,drawTechnique, renderFlags)
 {
     m_atmosphereWavelengths = atmosphereWavelengths;
     m_atmosphereRadius = atmosphereRadius;
     m_planetRadius = planetRadius;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:7,代码来源:MyRenderAtmosphere.cs

示例4: MyRenderObject

        public MyMwcVector3Int? RenderCellCoord; //Render cell coordinate if voxel
 


        public MyRenderObject(MyEntity entity, MyMwcVector3Int? renderCellCoord)
        {
            Entity = entity;
            Flags = MyElementFlag.EF_AABB_DIRTY;
            m_renderFlags = RenderFlags.SkipIfTooSmall | RenderFlags.NeedsResolveCastShadow;
            RenderCellCoord = renderCellCoord;
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:11,代码来源:MyRenderObject.cs

示例5: MyRenderBatch

 public MyRenderBatch(uint id, string debugName, MatrixD worldMatrix, RenderFlags renderFlags, List<MyRenderBatchPart> batchParts)
     : base(id, debugName, worldMatrix, renderFlags)
 {
     m_localAABB = BoundingBoxD.CreateInvalid();
     m_batchParts.Clear();
     m_batchParts.AddList(batchParts);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:7,代码来源:MyRenderBatch.cs

示例6: MyRenderObject

 public MyRenderObject(uint id, string debugName, RenderFlags renderFlags = RenderFlags.Visible | RenderFlags.SkipIfTooSmall | RenderFlags.NeedsResolveCastShadow, CullingOptions cullingOptions = VRageRender.CullingOptions.Default)
     : base(id)
 {
     DebugName = debugName;
     Flags = MyElementFlag.EF_AABB_DIRTY;
     m_renderFlags = renderFlags;
     m_cullingOptions = cullingOptions;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyRenderObject.cs

示例7: 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

示例8: 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

示例9: MyClipmapHandler

        internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, VRage.Voxels.MyClipmap.PruningFunc prunningFunc)
        {
            m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc);
            m_massiveCenter = massiveCenter;
            m_renderFlags = additionalFlags;

            if (spherize)
                m_massiveRadius = massiveRadius;

            const int mergeLodSubdivideCount = 3;
            m_mergeHandler = new MyLodMeshMergeHandler(Base, MyCellCoord.MAX_LOD_COUNT, mergeLodSubdivideCount, ref worldMatrix, ref massiveCenter, massiveRadius, m_renderFlags);

            MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, Base);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:14,代码来源:MyClipmapHandler.cs

示例10: MyClipmapCellProxy

		internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix, RenderFlags additionalFlags = 0)
        {
            m_worldMatrix = worldMatrix;

            m_actor = MyActorFactory.CreateSceneObject();
            m_actor.SetMatrix(ref worldMatrix);
            m_actor.AddComponent(MyComponentFactory<MyFoliageComponent>.Create());

            m_lod = cellCoord.Lod;

            Mesh = MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod);
            m_actor.GetRenderable().SetModel(Mesh);
			m_actor.GetRenderable().m_additionalFlags = MyProxiesFactory.GetRenderableProxyFlags(additionalFlags);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:14,代码来源:MyClipmapCellProxy.cs

示例11: MyClipmapHandler

        internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, VRage.Voxels.MyClipmap.PruningFunc prunningFunc)
        {
            m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc);
            m_massiveCenter = massiveCenter;
            m_renderFlags = additionalFlags;
            m_mergeHandler = null;

            if (spherize)
                m_massiveRadius = massiveRadius;

            if (MyLodMeshMergeHandler.ShouldAllocate(m_mergeHandler))
                m_mergeHandler = AllocateMergeHandler();

            MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, Base);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:15,代码来源:MyClipmapHandler.cs

示例12: MyRenderEntity

        public MyRenderEntity(uint id, string debugName, string model, MatrixD worldMatrix, MyMeshDrawTechnique drawTechnique, RenderFlags renderFlags)
            : base(id, debugName, worldMatrix, renderFlags)
        {
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(model));

            var renderModel = AddLODs(model);
            if (renderModel != null)
            {
                m_localAABB = (BoundingBoxD)renderModel.BoundingBox;
                m_localVolume = (BoundingSphereD)renderModel.BoundingSphere;
                m_localVolumeOffset = (Vector3D)renderModel.BoundingSphere.Center;
            }

            m_drawTechnique = drawTechnique;
            m_isDataSet = true;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:16,代码来源:MyRenderEntity.cs

示例13: 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

示例14: DrawText

    /// <summary>
    /// Draw some text on the screen.
    /// </summary>
    /// <param name="xpos">The X position.</param>
    /// <param name="ypos">The Y position.</param>
    /// <param name="color">The font color.</param>
    /// <param name="text">The actual text.</param>
    /// <param name="flags">Font render flags.</param>
    protected void DrawText(float xpos, float ypos, Color color, string text, RenderFlags flags, int maxWidth)
    {
      lock (GUIFontManager.Renderlock)
      {
        if (text == null)
        {
          return;
        }
        if (text.Length == 0)
        {
          return;
        }
        if (xpos <= 0)
        {
          return;
        }
        if (ypos <= 0)
        {
          return;
        }
        if (maxWidth < -1)
        {
          return;
        }


        text = GetRTLText(text);

        if (ID >= 0)
        {
          if (containsOutOfBoundsChar(text))
          {
            GUIFontManager.DrawText(_d3dxFont, xpos, ypos, color, text, maxWidth, _fontHeight);
            return;
          }

          int intColor = color.ToArgb();
          unsafe
          {
            float[,] matrix = GUIGraphicsContext.GetFinalMatrix();

            IntPtr ptrStr = Marshal.StringToCoTaskMemUni(text); //SLOW
            DXNative.FontEngineDrawText3D(ID, (void*)(ptrStr.ToPointer()), (int)xpos, (int)ypos, (uint)intColor, maxWidth,
                                                 matrix);
            Marshal.FreeCoTaskMem(ptrStr);
            return;
          }
        }
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:58,代码来源:GUIFont.cs

示例15: MyRenderAtmosphere

 public MyRenderAtmosphere(uint id, string debugName, MatrixD worldMatrix, MyMeshDrawTechnique drawTechnique, RenderFlags renderFlags)
     : base(id, debugName, worldMatrix,drawTechnique, renderFlags)
 {
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:4,代码来源:MyRenderAtmosphere.cs


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