• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MyLodTypeEnum类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetupVoxelEntity

        public static void SetupVoxelEntity(MyLodTypeEnum lod, MyEffectBase shader, MyRender.MyRenderElement renderElement)
        {
            MyEffectVoxels effectVoxels = shader as MyEffectVoxels;

            {
                MatrixD worldMatrixD = renderElement.WorldMatrix;
                worldMatrixD.Translation -= MyRenderCamera.Position;
                var worldMatrix = (Matrix)worldMatrixD;
                effectVoxels.SetWorldMatrix(ref worldMatrix);
            }

            var voxelCell = renderElement.RenderObject as MyRenderVoxelCell;
            if (voxelCell != null)
            {
                MyRenderVoxelCell.EffectArgs args;
                voxelCell.GetEffectArgs(out args);
                effectVoxels.VoxelVertex.SetArgs(ref args);
            }

            effectVoxels.SetDiffuseColor(Vector3.One);
            if (MyRenderSettings.DebugClipmapLodColor && renderElement.VoxelBatch.Lod < MyRenderVoxelCell.LOD_COLORS.Length)
            {
                effectVoxels.SetDiffuseColor(MyRenderVoxelCell.LOD_COLORS[renderElement.VoxelBatch.Lod].ToVector3());
            }
            effectVoxels.EnablePerVertexAmbient(MyRender.Settings.EnablePerVertexVoxelAmbient);

            if (lod == MyLodTypeEnum.LOD_BACKGROUND && renderElement.RenderObject is MyRenderVoxelCellBackground)
            {
                SetupAtmosphere(effectVoxels, renderElement.RenderObject as MyRenderVoxelCellBackground);
            }
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:31,代码来源:MyDrawTechniqueVoxelSingle.cs


示例2: SetupVoxelEntity

        public static void SetupVoxelEntity(MyLodTypeEnum lod,MyEffectBase shader, MyRender.MyRenderElement renderElement)
        {
            MyEffectVoxels effectVoxels = shader as MyEffectVoxels;

            {
                MatrixD worldMatrixD = renderElement.WorldMatrix;
                worldMatrixD.Translation -= MyRenderCamera.Position;
                var worldMatrix = (Matrix)worldMatrixD;
                effectVoxels.SetWorldMatrix(ref worldMatrix);
            }

            //effectVoxels.SetVoxelMapPosition((Vector3)(renderElement.WorldMatrix.Translation - MyRenderCamera.Position));
            //effectVoxels.SetPositionLocalOffset((Vector3)(renderElement.WorldMatrix.Right));
            //effectVoxels.SetPositionLocalScale((Vector3)(renderElement.WorldMatrix.Up));
            //effectVoxels.SetLodBounds(new Vector2((float)renderElement.WorldMatrix.M14, (float)renderElement.WorldMatrix.M24));
            effectVoxels.SetDiffuseColor(Vector3.One);
            if (MyRenderSettings.DebugClipmapLodColor && renderElement.VoxelBatch.Lod < MyRenderVoxelCell.LOD_COLORS.Length)
            {
                effectVoxels.SetDiffuseColor(MyRenderVoxelCell.LOD_COLORS[renderElement.VoxelBatch.Lod].ToVector3());
            }
            effectVoxels.EnablePerVertexAmbient(MyRender.Settings.EnablePerVertexVoxelAmbient);

            if (lod == MyLodTypeEnum.LOD_BACKGROUND && renderElement.RenderObject is MyRenderVoxelCellBackground)
            {
                SetupAtmosphere(effectVoxels, renderElement.RenderObject as MyRenderVoxelCellBackground);
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:27,代码来源:MyDrawTechniqueVoxelSingle.cs


示例3: Add

 internal void Add(MyLodTypeEnum lod, List<MyRender.MyRenderElement> m_renderElements)
 {
     foreach (var el in m_renderElements)
     {
         Add(lod, el);
     }
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:7,代码来源:MySortedElements.cs


示例4: PrepareAndBeginShader

        public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType)
        {
            var shader = (MyEffectModelsDNS)MyRender.GetEffect(MyEffects.ModelDNS);
            SetupBaseEffect(shader, setup, lodType);

            MyEffectModelsDNS dnsShader = shader as MyEffectModelsDNS;

            dnsShader.SetHalfPixel(MyRenderCamera.Viewport.Width, MyRenderCamera.Viewport.Height);
            dnsShader.SetScale(MyRender.GetScaleForViewport(MyRender.GetRenderTarget(MyRenderTargets.Depth)));

            bool useDepth = lodType != MyLodTypeEnum.LOD_NEAR;

            if (useDepth)
            {
                // DepthStencilState.DepthRead;
                MyStateObjects.DepthStencil_TestFarObject_DepthReadOnly.Apply();
            }
            else
            {
                DepthStencilState.DepthRead.Apply();
            }
            MyStateObjects.Holo_BlendState.Apply();

            shader.ApplyHolo(!useDepth);
            shader.Begin(0, SharpDX.Direct3D9.FX.None);
            return shader;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:27,代码来源:MyDrawTechniqueHolo.cs


示例5: MyVoxelPrecalcTaskItem

 public MyVoxelPrecalcTaskItem(MyLodTypeEnum type, MyVoxelMap voxelMap, MyVoxelCacheCellData cache, MyMwcVector3Int voxelStart)
 {
     Type = type;
     VoxelMap = voxelMap;
     Cache = cache;
     VoxelStart = voxelStart;
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:7,代码来源:MyVoxelPrecalc.cs


示例6: GetRenderElements

        public override void GetRenderElements(MyLodTypeEnum lodTypeEnum, List<MyRender.MyRenderElement> elements, List<MyRender.MyRenderElement> transparentElements)
        {
            if (MyRender.Settings.SkipVoxels)
                return;

            Debug.Assert(lodTypeEnum == MyLodTypeEnum.LOD0 || lodTypeEnum == MyLodTypeEnum.LOD_BACKGROUND);

            foreach (MyRenderVoxelBatch batch in m_batches)
            {
                if (batch.IndexBuffer == null)
                    continue;

                MyRender.MyRenderElement renderElement;
                MyRender.AllocateRenderElement(out renderElement);

                if (!MyRender.IsRenderOverloaded)
                {
                    //renderElement.DebugName = this.Name;
                    SetupRenderElement(batch, renderElement);

                    renderElement.DrawTechnique = MyMeshDrawTechnique.VOXEL_MAP;
                    renderElement.Material = m_fakeVoxelMaterial;

                    elements.Add(renderElement);
                }
                else if (renderElement == null)
                {
                    break;
                }

            }
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:32,代码来源:MyRenderVoxelCell.cs


示例7: MyVoxelPrecalcTaskItem

 public MyVoxelPrecalcTaskItem(MyLodTypeEnum type, MyVoxelMap voxelMap, MyVoxelGeometry.CellData cache, Vector3I voxelStart)
 {
     Type = type;
     VoxelMap = voxelMap;
     Cache = cache;
     VoxelStart = voxelStart;
 }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:7,代码来源:MyVoxelPrecalc.cs


示例8: DrawVoxels

        private static void DrawVoxels(MyLodTypeEnum lod, MyVoxelCacheCellRenderBatchType batchType, ref int ibChangesStats)
        {
            int index = m_sortedElements.GetVoxelIndex(lod, batchType);
            var matDict = m_sortedElements.Voxels[index];

            if (matDict.RenderElementCount == 0)
                return;

            // Technique start
            var shader = GetShader(MyMeshDrawTechnique.VOXEL_MAP);
            SetupShaderPerDraw(shader, MyMeshDrawTechnique.VOXEL_MAP);
            BeginShaderAlternative(shader, MyMeshDrawTechnique.VOXEL_MAP, batchType);
            shader.Begin();

            MyPerformanceCounter.PerCameraDraw.TechniqueChanges[(int)lod]++;

            foreach (var mat in matDict.Voxels)
            {
                var firstElement = mat.Value.FirstOrDefault();
                if (firstElement == null)
                    continue;

                // Setup material
                SetupShaderForMaterialAlternative(shader, batchType, firstElement.VoxelBatch.Material0, firstElement.VoxelBatch.Material1, firstElement.VoxelBatch.Material2);
                MyPerformanceCounter.PerCameraDraw.MaterialChanges[(int)lod]++;
                
                MyEntity lastEntity = null;
                VertexBuffer lastVertexBuffer = null;

                foreach (var renderElement in mat.Value)
                {
                    if (!object.ReferenceEquals(lastVertexBuffer, renderElement.VertexBuffer))
                    {
                        lastVertexBuffer = renderElement.VertexBuffer;
                        m_device.Indices = renderElement.IndexBuffer;
                        m_device.SetStreamSource(0, renderElement.VertexBuffer, 0, renderElement.VertexStride);
                        m_device.VertexDeclaration = renderElement.VertexDeclaration;
                        MyPerformanceCounter.PerCameraDraw.VertexBufferChanges[(int)lod]++;
                        ibChangesStats++;
                    }

                    if (lastEntity != renderElement.Entity)
                    {
                        lastEntity = renderElement.Entity;
                        MyPerformanceCounter.PerCameraDraw.EntityChanges[(int)lod]++;
                        SetupShaderForEntity(shader, renderElement);
                        shader.D3DEffect.CommitChanges();
                    }

                    m_renderProfiler.StartProfilingBlock("DrawIndexedPrimitives");
                    m_device.DrawIndexedPrimitive(PrimitiveType.TriangleList, 0, 0, renderElement.VertexCount, renderElement.IndexStart, renderElement.TriCount);
                    MyPerformanceCounter.PerCameraDraw.TotalDrawCalls++;
                    m_renderProfiler.EndProfilingBlock();
                }
            }

            shader.End();
            // Technique End
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:59,代码来源:MyRender.Alternative.cs


示例9: GetRenderElements

        public override void GetRenderElements(MyLodTypeEnum lodTypeEnum, List<MyRender.MyRenderElement> elements, List<MyRender.MyRenderElement> transparentElements)
        {
            MyPerformanceCounter.PerCameraDrawWrite.EntitiesRendered++;

            //   GetRenderProfiler().StartNextBlock("Collect render elements");
            CollectRenderElements(elements, transparentElements, m_lods[0].Model, m_lods[0].MeshMaterials, 0);
            //   GetRenderProfiler().EndProfilingBlock();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyRenderVoxelDebris.cs


示例10: PrepareAndBeginShader

        public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType)
        {
            var shader = (MyEffectModelsDNS)MyRender.GetEffect(MyEffects.ModelDNS);
            SetupBaseEffect(shader, setup, lodType);

            shader.ApplyMasked();
            shader.Begin(0, SharpDX.Direct3D9.FX.None);
            return shader;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:9,代码来源:MyDrawTechniqueAlphaMasked.cs


示例11: PrepareAndBeginShader

        public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType)
        {
            var shader = (MyEffectModelsDNS)MyRender.GetEffect(MyEffects.ModelDNS);
            SetupBaseEffect(shader, setup, lodType);

            shader.SetTechnique(MyRenderConstants.RenderQualityProfile.ModelsInstancedSkinnedTechnique);
            shader.Begin(0, SharpDX.Direct3D9.FX.None);
            return shader;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:9,代码来源:MyDrawTechniqueMeshInstancedSkinned.cs


示例12: PrepareAndBeginShader

        public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType)
        {
            MyEffectVoxelsDebris shader = (MyEffectVoxelsDebris)MyRender.GetEffect(MyEffects.VoxelDebrisMRT);
            SetupBaseEffect(shader, setup, lodType);

            shader.SetTechnique(MyRenderConstants.RenderQualityProfile.VoxelsRenderTechnique);
            shader.Begin(0, SharpDX.Direct3D9.FX.None);
            return shader;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:9,代码来源:MyDrawTechniqueVoxelDebris.cs


示例13: PrepareAndBeginShader

        public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType)
        {
            var shader = (MyEffectAtmosphere)MyRender.GetEffect(MyEffects.Atmosphere);
            SetupBaseEffect(shader, setup, lodType);

            shader.SetSurfaceTechnique();
            shader.Begin(0, SharpDX.Direct3D9.FX.None);
            return shader;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:9,代码来源:MyDrawTechniquePlanetSurface.cs


示例14: DrawVoxels

        private static void DrawVoxels(MySortedElements sortedElements, MyLodTypeEnum lod, MyRenderVoxelBatchType batchType, ref int ibChangesStats)
        {
            int index = sortedElements.GetVoxelIndex(lod, batchType);
            var matDict = sortedElements.Voxels[index];

            if (matDict.RenderElementCount == 0)
                return;

            var tech = GetTechnique(batchType == MyRenderVoxelBatchType.SINGLE_MATERIAL ? MyMeshDrawTechnique.VOXEL_MAP_SINGLE : MyMeshDrawTechnique.VOXEL_MAP_MULTI);
           
            var shader = (MyEffectVoxels)tech.PrepareAndBeginShader(m_currentSetup, lod);         
            MyPerformanceCounter.PerCameraDrawWrite.TechniqueChanges[(int)lod]++;
           
            foreach (var mat in matDict.Voxels)
            {
                var firstElement = mat.Value.FirstOrDefault();
                if (firstElement == null)
                    continue;

               
                // Setup material
                tech.SetupVoxelMaterial(shader, firstElement.VoxelBatch);
                MyPerformanceCounter.PerCameraDrawWrite.MaterialChanges[(int)lod]++;

                MyRenderObject lastRenderObject = null;
                VertexBuffer lastVertexBuffer = null;

                foreach (var renderElement in mat.Value)
                {
                    if (!object.ReferenceEquals(lastVertexBuffer, renderElement.VertexBuffer))
                    {
                        lastVertexBuffer = renderElement.VertexBuffer;
                        GraphicsDevice.Indices = renderElement.IndexBuffer;
                        GraphicsDevice.SetStreamSource(0, renderElement.VertexBuffer, 0, renderElement.VertexStride);
                        GraphicsDevice.VertexDeclaration = renderElement.VertexDeclaration;
                        MyPerformanceCounter.PerCameraDrawWrite.VertexBufferChanges[(int)lod]++;
                        ibChangesStats++;
                    }

                    if (lastRenderObject != renderElement.RenderObject)
                    {
                        lastRenderObject = renderElement.RenderObject;
                        MyPerformanceCounter.PerCameraDrawWrite.EntityChanges[(int)lod]++;
                        tech.SetupEntity(shader, renderElement);                     
                        shader.D3DEffect.CommitChanges();
                    }

                    GraphicsDevice.DrawIndexedPrimitive(PrimitiveType.TriangleList, 0, 0, renderElement.VertexCount, renderElement.IndexStart, renderElement.TriCount);
                    MyPerformanceCounter.PerCameraDrawWrite.TotalDrawCalls++;
                }
            }

            shader.End();
            // Technique End
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:55,代码来源:MyRender-AlternativeSort.cs


示例15: GetRenderElements

        public override void GetRenderElements(MyLodTypeEnum lodTypeEnum, List<MyRender.MyRenderElement> elements, List<MyRender.MyRenderElement> transparentElements)
        {
            if (MyRender.CurrentRenderSetup.CallerID.HasValue && MyRender.CurrentRenderSetup.CallerID.Value == MyRenderCallerEnum.EnvironmentMap && this.EntityDithering > 0)
            {
                return;
            }

            Debug.Assert(m_isDataSet, "Data is not set, have you forgotten to send SetRenderEntityData message?");

            MyRenderModel currentModel = m_lods[0].Model;
            List<MyRenderMeshMaterial> currentMaterials = m_lods[0].MeshMaterials;

            var volume = WorldVolume;
            var lodIndex = 0;

            if (lodTypeEnum == MyLodTypeEnum.LOD_NEAR)
            {

            }
            else
                if (lodTypeEnum == MyLodTypeEnum.LOD0)
                {
                    if (m_lods.Count > 1)
                    {
                        var distance = MyUtils.GetSmallestDistanceToSphereAlwaysPositive(ref MyRenderCamera.Position, ref volume);

                        if (distance > MyRenderCamera.FAR_PLANE_DISTANCE)
                            return;

                        for (int i = 1; i < m_lods.Count; i++)
                        {
                            var lod = m_lods[i];
                            if (distance < lod.Distance)
                                break;

                            currentModel = lod.Model;
                            currentMaterials = lod.MeshMaterials;
                            lodIndex = i;
                        }
                    }
                }
                else
                    return; //nothing to render in LOD1

            if (currentModel == null)
                return;

            int instanceCount = m_instanceBuffer != null ? m_instanceCount : 1;

            MyRender.ModelTrianglesCountStats += currentModel.GetTrianglesCount() * instanceCount;

            MyPerformanceCounter.PerCameraDrawWrite.EntitiesRendered++;

            CollectRenderElements(elements, transparentElements, currentModel, currentMaterials, lodIndex);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:55,代码来源:MyRenderEntity.cs


示例16: DrawRenderElementsAlternative

        private static void DrawRenderElementsAlternative(MySortedElements sortedElements, MyLodTypeEnum lod, out int ibChangesStats)
        {
            m_currentLodDrawPass = lod;

            ibChangesStats = 0;

            BlendState.Opaque.Apply(); //set by default, blend elements are at the end.

            DrawVoxels(sortedElements, lod, MyRenderVoxelBatchType.SINGLE_MATERIAL, ref ibChangesStats);
            DrawVoxels(sortedElements, lod, MyRenderVoxelBatchType.MULTI_MATERIAL, ref ibChangesStats);
            DrawModels(sortedElements, lod, ref ibChangesStats);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:12,代码来源:MyRender-AlternativeSort.cs


示例17: PrepareAndBeginShader

        public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType)
        {
            var shader = (MyEffectModelsDNS)MyRender.GetEffect(MyEffects.ModelDNS);
            SetupBaseEffect(shader, setup, lodType);

            MyStateObjects.Static_Decals_BlendState.Apply();
            MyStateObjects.DepthStencil_TestFarObject_DepthReadOnly.Apply();

            shader.BeginBlended();
            shader.Begin(0, SharpDX.Direct3D9.FX.None);
            return shader;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:12,代码来源:MyDrawTechniqueDecal.cs


示例18: AddVoxel

 public void AddVoxel(MyLodTypeEnum lod, MyRender.MyRenderElement renderElement)
 {
     var matDict = Voxels[GetVoxelIndex(lod, renderElement.VoxelBatch.Type)];
     List<MyRender.MyRenderElement> elements;
     if (!matDict.Voxels.TryGetValue(renderElement.VoxelBatch.MaterialId, out elements))
     {
         elements = new List<MyRender.MyRenderElement>(20);
         matDict.Voxels[renderElement.VoxelBatch.MaterialId] = elements;
     }
     matDict.RenderElementCount++;
     elements.Add(renderElement);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:12,代码来源:MySortedElements.cs


示例19: PrepareAndBeginShader

        public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType)
        {
            var shader = MyRender.GetEffect(MyEffects.VoxelsMRT) as MyEffectVoxels;
            SetupBaseEffect(shader, setup, lodType);

            {
                shader.Apply();
            }
            m_currentLod = lodType;
            shader.Begin(0, SharpDX.Direct3D9.FX.None);
            return shader;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:12,代码来源:MyDrawTechniqueVoxelSingle.cs


示例20: DrawRenderElementsAlternative

        private static void DrawRenderElementsAlternative(MyLodTypeEnum lod, bool applyStencil, out int ibChangesStats)
        {
            m_currentLodDrawPass = lod;

            ibChangesStats = 0;

            BlendState.Opaque.Apply(); //set by default, blend elements are at the end. 
            DrawVoxels(lod, MyVoxelCacheCellRenderBatchType.SINGLE_MATERIAL, ref ibChangesStats);
            DrawVoxels(lod, MyVoxelCacheCellRenderBatchType.MULTI_MATERIAL, ref ibChangesStats);

            BlendState.Opaque.Apply(); //set by default, blend elements are at the end. 
            DrawModels(lod, ref ibChangesStats);
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:13,代码来源:MyRender.Alternative.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyMath类代码示例发布时间:2022-05-24
下一篇:
C# MyList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap