本文整理汇总了C#中RenderState类的典型用法代码示例。如果您正苦于以下问题:C# RenderState类的具体用法?C# RenderState怎么用?C# RenderState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenderState类属于命名空间,在下文中一共展示了RenderState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRenderCore
protected override void OnRenderCore(DrawingContext dc, RenderState state)
{
if (DataSource == null) return;
var transform = Plotter2D.Viewport.Transform;
Rect bounds = Rect.Empty;
using (IPointEnumerator enumerator = DataSource.GetEnumerator(GetContext()))
{
Point point = new Point();
while (enumerator.MoveNext())
{
enumerator.GetCurrent(ref point);
enumerator.ApplyMappings(this);
Point zero = new Point(point.X, 0);
Point screenPoint = point.DataToScreen(transform);
Point screenZero = zero.DataToScreen(transform);
double height = screenPoint.Y = screenZero.Y;
height = (height >= 0) ? height : -height;
dc.DrawRectangle(Fill, new Pen(Stroke, StrokeThickness),
new Rect(screenPoint.X - BarWidth / 2, screenZero.Y, BarWidth, height));
bounds = Rect.Union(bounds, point);
}
}
ContentBounds = bounds;
}
示例2: StartEffect
public void StartEffect(string text, float duration)
{
_renderState = RenderState.Rendering;
_sequense = null;
_sequense = DOTween.Sequence();
_animation = _textUI.DOText(text, duration);
_sequense.Append(_animation);
_sequense.AppendCallback(new TweenCallback(FinishDisplay));
}
示例3: Render
/// <summary>
/// Renders the control</summary>
/// <param name="action">Render action</param>
/// <param name="camera">Camera</param>
/// <param name="state">Render state</param>
/// <param name="transform">Transform</param>
public void Render(IRenderAction action, Camera camera, RenderState state, Matrix4F transform)
{
float s1, s2, s3;
// apply xform
Gl.glPushMatrix();
Util3D.glMultMatrixf(transform);
CalcAxisLengths(camera, transform, out s1, out s2, out s3);
bool drawX, drawY, drawZ;
DecideArrowDrawing(transform, camera, out drawX, out drawY, out drawZ);
if (drawX)
{
RenderXArrow(s1);
RenderXAxis(s1);
}
if (drawY)
{
RenderYArrow(s2);
RenderYAxis(s2);
}
if (drawZ)
{
RenderZArrow(s3);
RenderZAxis(s3);
}
RenderXYSquare(s1 * SquareLength, s2 * SquareLength, true);
RenderYZSquare(s2 * SquareLength, s3 * SquareLength, true);
RenderXZSquare(s1 * SquareLength, s3 * SquareLength, true);
Gl.glPopMatrix();
}
示例4: Renderer
public Renderer(GraphicsDevice device, RenderState renderState)
{
RenderState = renderState;
Device = device;
_effect = new BasicEffect(Device);
_bufferedInstructions = new List<IEnumerable<RenderInstruction>>();
}
示例5: Paint
/// <summary>
/// The method that is passed to the BitmapContext for rendering the image using OpenGl</summary>
private void Paint()
{
// Setup render state. Copied from RenderCommands.DoCommand()'s RenderSmooth.
RenderState rs = new RenderState();
rs.RenderMode =
RenderMode.Smooth |
RenderMode.SolidColor |
RenderMode.Lit |
RenderMode.CullBackFace |
RenderMode.Textured;
rs.SolidColor = new Vec4F(1, 1, 1, 1);
m_scene.StateStack.Push(rs);
// Change some settings related to printing information text. We don't want it.
string originalTitle = m_action.Title;
m_action.Title = string.Empty;
bool originalStatsEnabled = Util3D.RenderStats.Enabled;
Util3D.RenderStats.Enabled = false;
// Dispatch the scene
m_action.Dispatch(m_scene, m_camera);
// Restore some settings.
m_action.Title = originalTitle;
Util3D.RenderStats.Enabled = originalStatsEnabled;
}
示例6: PreRenderCode
protected override void PreRenderCode(RenderState state)
{
if (ShowMeasure)
AddMeasure();
IsGrey = true;
base.PreRenderCode(state);
}
示例7: TraverseNode
/// <summary>
/// Constructor</summary>
/// <param name="renderObject">RenderObject. A reference is held to this, so that IRenderObject.Dispatch
/// can be called.</param>
/// <param name="transform">Transform to use when dispatching the RenderObject; a reference is held</param>
/// <param name="graphPath">Graph path leading to RenderObject; a reference is held</param>
/// <param name="renderState">RenderState to use for RenderObject; is copied</param>
public TraverseNode(
IRenderObject renderObject,
Matrix4F transform,
Stack<SceneNode> graphPath,
RenderState renderState)
{
Init(renderObject, transform, graphPath, renderState);
}
示例8: GraphicsDevice
public GraphicsDevice()
{
BitmapCacheEnabled = true;
RenderAtScale = 1;
RenderState = new RenderState();
PresentationParameters = new PresentationParameters();
PresentationParameters.BackBufferFormat = SurfaceFormat.Canvas;
}
示例9: SetTemporaryRenderState
public void SetTemporaryRenderState(RenderState renderState, int value)
{
int oldState = _device.GetRenderState(renderState);
if (oldState.Equals(value))
return;
_changedStates[renderState] = oldState;
_device.SetRenderState(renderState, value);
}
示例10: TextureBaker
public TextureBaker(GraphicsDevice graphicsDevice, int width, int height, RenderState state)
: base(graphicsDevice)
{
_renderTarget = new RenderTarget2D(GraphicsDevice, width, height);
GraphicsDevice.SetRenderTarget(_renderTarget);
GraphicsDevice.Clear(Color.Transparent);
Begin(SpriteSortMode.Immediate, BlendState.Opaque);
SetState(state);
}
示例11: ProcessCustomElement
public async Task<Errorable<bool>> ProcessCustomElement(string elementName, RenderState state)
{
if (elementName != "cms-scheduled") return false;
var err = await processScheduledElement(state).ConfigureAwait(continueOnCapturedContext: false);
if (err.HasErrors) return err.Errors;
return true;
}
示例12: FontStyle
public FontStyle( string fontName )
{
Font = _UI.Font.Get( fontName );
RenderState = new RenderState( (int)E_Effect.IntensityAsAlpha_PMA, E_BlendState.AlphaBlend );
TrackingPercentage = 0.0f;
HeightPercentage = 1.0f;
RenderPasses = new List< FontStyleRenderPass >();
}
示例13: Init
// Init
public void Init()
{
Texture.TextureIndex = 0;
Texture.PUV = new Vector2( 0.0f );
Texture.SUV = new Vector2( 1.0f );
Color = 0xffffffff;
AspectRatio = 1.0f;
Scale = 1.0f;
RenderState = new RenderState( (int)E_Effect.MultiTexture1, E_BlendState.AlphaBlend );
LayerOffset = 0;
}
示例14: Init
/// <summary>
/// Initializes instance</summary>
/// <param name="renderObject">RenderObject. A reference is held to this, so that IRenderObject.Dispatch
/// can be called.</param>
/// <param name="transform">Transform to use when dispatching the RenderObject; a reference is held</param>
/// <param name="graphPath">Graph path leading to RenderObject; a reference is held</param>
/// <param name="renderState">RenderState to use for RenderObject; is copied</param>
public void Init(
IRenderObject renderObject,
Matrix4F transform,
Stack<SceneNode> graphPath,
RenderState renderState)
{
m_renderObject = renderObject;
m_transform = transform;
m_renderState.Init(renderState);
m_graphPath = graphPath.ToArray();//faster to create every time than to cache!
}
示例15: RenderStatesDiffer
private static bool RenderStatesDiffer(RenderState oldRenderState, RenderState newRenderState, RenderMode flag)
{
bool oldRenderStateNull = (oldRenderState == null);
bool newFlag = ((newRenderState.RenderMode & flag) != 0);
if (oldRenderStateNull)
return true;
bool oldFlag = ((oldRenderState.RenderMode & flag) != 0);
return oldFlag != newFlag;
}