C# Class Nez.Batcher

Inheritance: GraphicsResource
显示文件 Open project: prime31/Nez Class Usage Examples

Public Methods

Method Description
Batcher ( GraphicsDevice graphicsDevice ) : System
begin ( ) : void
begin ( BlendState blendState ) : void
begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState ) : void
begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect ) : void
begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformationMatrix ) : void
begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformationMatrix, bool disableBatching ) : void
begin ( Effect effect ) : void
begin ( Material material ) : void
begin ( Material material, Matrix transformationMatrix ) : void
begin ( Matrix transformationMatrix ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Color color ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, SpriteEffects effects, float layerDepth, float skewTopX, float skewBottomX, float skewLeftY, float skewRightY ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Color color ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, float skewTopX, float skewBottomX, float skewLeftY, float skewRightY ) : void
draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void
drawPrimitives ( Texture texture, int baseSprite, int batchSize ) : void
drawRaw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector3 verts, Vector2 textureCoords, Color colors ) : void

direct access to setting vert positions, UVs and colors. The order of elements is top-left, top-right, bottom-left, bottom-right

enableScissorTest ( bool shouldEnable ) : void

enables/disables scissor testing. If the RasterizerState changes it will cause a batch flush.

end ( ) : void
flushBatch ( ) : void
prepRenderState ( ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
DrawString ( SpriteFont spriteFont, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth ) : void
checkBegin ( ) : void
generateIndexArray ( ) : short[]
pushSprite ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle sourceRectangle, float destinationX, float destinationY, float destinationW, float destinationH, Color color, Vector2 origin, float rotation, float depth, byte effects, bool destSizeInPixels, float skewTopX, float skewBottomX, float skewLeftY, float skewRightY ) : void

Method Details

Batcher() public method

public Batcher ( GraphicsDevice graphicsDevice ) : System
graphicsDevice GraphicsDevice
return System

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

begin() public method

public begin ( ) : void
return void

begin() public method

public begin ( BlendState blendState ) : void
blendState Microsoft.Xna.Framework.Graphics.BlendState
return void

begin() public method

public begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState ) : void
blendState Microsoft.Xna.Framework.Graphics.BlendState
samplerState Microsoft.Xna.Framework.Graphics.SamplerState
depthStencilState Microsoft.Xna.Framework.Graphics.DepthStencilState
rasterizerState Microsoft.Xna.Framework.Graphics.RasterizerState
return void

begin() public method

public begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect ) : void
blendState Microsoft.Xna.Framework.Graphics.BlendState
samplerState Microsoft.Xna.Framework.Graphics.SamplerState
depthStencilState Microsoft.Xna.Framework.Graphics.DepthStencilState
rasterizerState Microsoft.Xna.Framework.Graphics.RasterizerState
effect Microsoft.Xna.Framework.Graphics.Effect
return void

begin() public method

public begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformationMatrix ) : void
blendState Microsoft.Xna.Framework.Graphics.BlendState
samplerState Microsoft.Xna.Framework.Graphics.SamplerState
depthStencilState Microsoft.Xna.Framework.Graphics.DepthStencilState
rasterizerState Microsoft.Xna.Framework.Graphics.RasterizerState
effect Microsoft.Xna.Framework.Graphics.Effect
transformationMatrix Matrix
return void

begin() public method

public begin ( BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformationMatrix, bool disableBatching ) : void
blendState Microsoft.Xna.Framework.Graphics.BlendState
samplerState Microsoft.Xna.Framework.Graphics.SamplerState
depthStencilState Microsoft.Xna.Framework.Graphics.DepthStencilState
rasterizerState Microsoft.Xna.Framework.Graphics.RasterizerState
effect Microsoft.Xna.Framework.Graphics.Effect
transformationMatrix Matrix
disableBatching bool
return void

begin() public method

public begin ( Effect effect ) : void
effect Microsoft.Xna.Framework.Graphics.Effect
return void

begin() public method

public begin ( Material material ) : void
material Material
return void

begin() public method

public begin ( Material material, Matrix transformationMatrix ) : void
material Material
transformationMatrix Matrix
return void

begin() public method

public begin ( Matrix transformationMatrix ) : void
transformationMatrix Matrix
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
destinationRectangle Microsoft.Xna.Framework.Rectangle
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
destinationRectangle Microsoft.Xna.Framework.Rectangle
color Color
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
destinationRectangle Microsoft.Xna.Framework.Rectangle
sourceRectangle Microsoft.Xna.Framework.Rectangle
color Color
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, SpriteEffects effects, float layerDepth, float skewTopX, float skewBottomX, float skewLeftY, float skewRightY ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
destinationRectangle Microsoft.Xna.Framework.Rectangle
sourceRectangle Microsoft.Xna.Framework.Rectangle
color Color
rotation float
effects SpriteEffects
layerDepth float
skewTopX float
skewBottomX float
skewLeftY float
skewRightY float
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
destinationRectangle Microsoft.Xna.Framework.Rectangle
sourceRectangle Microsoft.Xna.Framework.Rectangle
color Color
rotation float
origin Vector2
effects SpriteEffects
layerDepth float
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
color Color
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
sourceRectangle Microsoft.Xna.Framework.Rectangle
color Color
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
sourceRectangle Microsoft.Xna.Framework.Rectangle
color Color
rotation float
origin Vector2
scale Vector2
effects SpriteEffects
layerDepth float
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, float skewTopX, float skewBottomX, float skewLeftY, float skewRightY ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
sourceRectangle Microsoft.Xna.Framework.Rectangle
color Color
rotation float
origin Vector2
scale Vector2
effects SpriteEffects
layerDepth float
skewTopX float
skewBottomX float
skewLeftY float
skewRightY float
return void

draw() public method

public draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
sourceRectangle Microsoft.Xna.Framework.Rectangle
color Color
rotation float
origin Vector2
scale float
effects SpriteEffects
layerDepth float
return void

drawPrimitives() public method

public drawPrimitives ( Texture texture, int baseSprite, int batchSize ) : void
texture Microsoft.Xna.Framework.Graphics.Texture
baseSprite int
batchSize int
return void

drawRaw() public method

direct access to setting vert positions, UVs and colors. The order of elements is top-left, top-right, bottom-left, bottom-right
public drawRaw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector3 verts, Vector2 textureCoords, Color colors ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D Texture.
verts Vector3 Verts.
textureCoords Vector2 Texture coords.
colors Color Colors.
return void

enableScissorTest() public method

enables/disables scissor testing. If the RasterizerState changes it will cause a batch flush.
public enableScissorTest ( bool shouldEnable ) : void
shouldEnable bool Should enable.
return void

end() public method

public end ( ) : void
return void

flushBatch() public method

public flushBatch ( ) : void
return void

prepRenderState() public method

public prepRenderState ( ) : void
return void