本文整理汇总了C#中IRenderable.Render方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderable.Render方法的具体用法?C# IRenderable.Render怎么用?C# IRenderable.Render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderable
的用法示例。
在下文中一共展示了IRenderable.Render方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public static string Render(IRenderable renderable)
{
var memoryStream = new MemoryStream();
var streamWriter = new StreamWriter(memoryStream, Encoding.UTF8);
streamWriter.AutoFlush = true;
renderable.Render(streamWriter);
memoryStream.Seek(0, SeekOrigin.Begin);
return new StreamReader(memoryStream, Encoding.UTF8).ReadToEnd();
}
示例2: Apply
/// <summary>
/// Applies this technique. Applies a pass, then invokes the render delegate to render stuff, for each pass
/// </summary>
/// <param name="context">Rendering context</param>
/// <param name="renderable">Object to render</param>
public override void Apply( IRenderContext context, IRenderable renderable )
{
Begin( );
if ( m_Passes.Count > 0 )
{
foreach ( IPass pass in m_Passes )
{
pass.Begin( );
renderable.Render( context );
pass.End( );
}
}
else
{
renderable.Render( context );
}
End( );
}
示例3: CreatePolygon
/// <summary>
/// This is the main function of the class, it'll create a triangulated polygon
/// from and SceneObject.
/// </summary>
/// <param name="gl">The gl.</param>
/// <param name="sourceObject">The object to convert.</param>
/// <param name="guarenteedView">A camera that can see the whole object.</param>
/// <returns>
/// A polygon created from 'sourceObject'.
/// </returns>
public Polygon CreatePolygon(OpenGL gl, IRenderable sourceObject, Camera guarenteedView)
{
// Save the current camera data.
gl.MatrixMode(OpenGL.GL_PROJECTION);
gl.PushMatrix();
// Look through the camera that can see the object.
guarenteedView.Project(gl);
// Start triangulation.
Begin(gl);
// Draw the object.
sourceObject.Render(gl, RenderMode.Design);
// End triangulation.
End(gl);
Polygon newPoly = Triangle;
newPoly.Name = (sourceObject is SceneElement ? ((SceneElement)sourceObject).Name : "Object") + " (Triangulated Poly)";
return newPoly;
}
示例4: Freeze
/// <summary>
/// Freezes the specified instance.
/// </summary>
/// <param name="gl">The gl instance.</param>
/// <param name="renderable">The renderable.</param>
public void Freeze(OpenGL gl, IRenderable renderable)
{
// Handle the trivial case.
if (isFrozen)
return;
// Create the display list.
if (displayList != null)
displayList.Delete(gl);
displayList = new DisplayList();
displayList.Generate(gl);
// Start the display list.
displayList.New(gl, DisplayList.DisplayListMode.Compile);
// Render the object.
renderable.Render(gl, RenderMode.Design);
// End the display list.
displayList.End(gl);
// We are now frozen.
isFrozen = true;
}
示例5: Apply
/// <summary>
/// Renders the specified object
/// </summary>
/// <param name="context">Rendering context</param>
/// <param name="renderable">Object to render</param>
public override void Apply( IRenderContext context, IRenderable renderable )
{
SetupTerrainEffect( m_Effect, m_Planet );
renderable.Render( context );
}
示例6: Render
public void Render(IRenderable entity, GameTime gameTime)
{
entity.Render(this, gameTime);
}
示例7: GetClickedHitTarget
// dependencies:
// - RendererFactory.GetInstance()
// - Tao.OpenGl
public HitTarget GetClickedHitTarget( IRenderable renderable, int MouseX, int MouseY )
{
GraphicsHelperGl g = new GraphicsHelperGl();
g.CheckError();
IRenderer renderer = RendererFactory.GetInstance();
ArrayList results = new ArrayList();
int[] viewport = new int[ 4 ];
Gl.glGetIntegerv( Gl.GL_VIEWPORT, viewport );
g.CheckError();
CreateSelectBuffer();
g.CheckError();
// This Creates A Matrix That Will Zoom Up To A Small Portion Of The Screen, Where The Mouse Is.
Gl.glMatrixMode( Gl.GL_PROJECTION );
g.CheckError();
Gl.glPushMatrix(); // save old matrix, we restore it at end
g.CheckError();
Gl.glLoadIdentity();
g.CheckError();
Glu.gluPickMatrix( (float)MouseX, (float)(renderer.WindowHeight - MouseY), 1.0f, 1.0f, viewport );
g.CheckError();
Glu.gluPerspective( renderer.FieldOfView, (float)renderer.WindowWidth / (float)renderer.WindowHeight, renderer.NearClip, renderer.FarClip );
g.CheckError();
Gl.glMatrixMode(Gl.GL_MODELVIEW);
g.CheckError();
Gl.glRenderMode( Gl.GL_SELECT );
g.CheckError();
Gl.glInitNames();
g.CheckError();
Gl.glPushName( 0 ); // Push one entry onto the stack; we will use LoadName to change this value throughout the rendering
g.CheckError();
bAddingNames = true;
hittargets = new ArrayList();
renderable.Render();
bAddingNames = false;
// return projection matrix to normal
Gl.glMatrixMode( Gl.GL_PROJECTION );
Gl.glPopMatrix();
Gl.glMatrixMode( Gl.GL_MODELVIEW );
int iNumHits = Gl.glRenderMode( Gl.GL_RENDER );
int hitname = GetNearestBufferName( iNumHits );
LogFile.WriteLine( "hitname: " + hitname.ToString() );
if( hitname == -1 || hitname == 0 )
{
LogFile.WriteLine("not in buffer");
return null;
}
FreeSelectBuffer();
new GraphicsHelperGl().CheckError();
if (hittargets.Count == 0)
{
return null;
}
if (iNumHits == 0)
{
//LogFile.WriteLine("no hits");
return null;
}
//LogFile.WriteLine(hittargets[hitname - 1]);
return (HitTarget)hittargets[ hitname - 1 ];
}
示例8: ApplyTechnique
/// <summary>
/// Renders a renderable object using a given technique
/// </summary>
public void ApplyTechnique( ITechnique technique, IRenderable renderable )
{
if ( renderable == null )
{
return;
}
if ( GlobalTechnique != null )
{
if ( technique != null )
{
if ( technique.Effect != null )
{
// GlobalTechnique and technique exist. technique is part of an effect group. Apply a substitute to GlobalTechnique
technique.Effect.SubstituteTechnique( GlobalTechnique ).Apply( this, renderable );
}
else if ( technique.IsSubstituteFor( GlobalTechnique ) )
{
// GlobalTechnique and technique exist. technique is a substitute for GlobalTechnique. Apply technique
technique.Apply( this, renderable );
}
else
{
// GlobalTechnique and technique exist. technique is not a substitute for GlobalTechnique. Apply GlobalTechnique
GlobalTechnique.Apply( this, renderable );
}
}
else
{
// GlobalTechnique exists, technique was null. Apply GlobalTechnique
GlobalTechnique.Apply( this, renderable );
}
}
else if ( technique != null )
{
// GlobalTechnique doesn't exist, technique does. Apply technique
technique.Apply( this, renderable );
}
else
{
// Neither GlobalTechnique or technique exist. Render object directly
renderable.Render( this );
}
}
示例9: Run
/// <summary>
/// Runs this node
/// </summary>
/// <param name="context">Rendering context</param>
/// <param name="renderable">Renderable object</param>
public virtual void Run( IRenderContext context, IRenderable renderable )
{
if ( renderable == null )
{
return;
}
// Update all bindings
foreach ( Binding binding in m_Bindings )
{
binding.Update( );
}
// Render the object
renderable.Render( context );
}
示例10: Apply
/// <summary>
/// Applies the selected technique (<see cref="ITechnique.Apply(IRenderContext, IRenderable)"/>) to render the specified object
/// </summary>
/// <param name="context">Rendering context</param>
/// <param name="renderable">Object to render</param>
public void Apply( IRenderContext context, IRenderable renderable )
{
if ( m_Technique != null )
{
m_Technique.Apply( context, renderable );
}
else
{
renderable.Render( context );
}
}