本文整理汇总了C#中MyLodTypeEnum类的典型用法代码示例。如果您正苦于以下问题:C# MyLodTypeEnum类的具体用法?C# MyLodTypeEnum怎么用?C# MyLodTypeEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyLodTypeEnum类属于命名空间,在下文中一共展示了MyLodTypeEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
示例3: Add
internal void Add(MyLodTypeEnum lod, List<MyRender.MyRenderElement> m_renderElements)
{
foreach (var el in m_renderElements)
{
Add(lod, el);
}
}
示例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;
}
示例5: MyVoxelPrecalcTaskItem
public MyVoxelPrecalcTaskItem(MyLodTypeEnum type, MyVoxelMap voxelMap, MyVoxelCacheCellData cache, MyMwcVector3Int voxelStart)
{
Type = type;
VoxelMap = voxelMap;
Cache = cache;
VoxelStart = voxelStart;
}
示例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;
}
}
}
示例7: MyVoxelPrecalcTaskItem
public MyVoxelPrecalcTaskItem(MyLodTypeEnum type, MyVoxelMap voxelMap, MyVoxelGeometry.CellData cache, Vector3I voxelStart)
{
Type = type;
VoxelMap = voxelMap;
Cache = cache;
VoxelStart = voxelStart;
}
示例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
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
示例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);
}