本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
}
}
}
示例15: MyRenderAtmosphere
public MyRenderAtmosphere(uint id, string debugName, MatrixD worldMatrix, MyMeshDrawTechnique drawTechnique, RenderFlags renderFlags)
: base(id, debugName, worldMatrix,drawTechnique, renderFlags)
{
}