// Process private Vector2 Process(ref StringProxy text, FontStyle fontStyle, int renderPass, int layer, ref Vector3 pos, float height, E_Align align, ref SpriteColors colors, float wrapSizeX) { RenderPass = renderPass; Layer = layer; Position = pos; Align = align; Colors = colors; if ((fontStyle.RenderState.BlendState == E_BlendState.AlphaBlend) && !Colors.PreMultipliedAlpha) { Colors.ToPremultiplied(); } return(Process(ref text, fontStyle, height, wrapSizeX, E_FontProcessType.Draw)); }
public unsafe void AddSprite(int renderPass, int layer, ref Vector3 pos, float sX, float sY, E_Align align, ref SpriteColors colors, ref RenderState renderState) { if (SpriteCount == SpriteCountMax) return; fixed(Sprite *pSprite = &Sprites[SpriteCount]) { pSprite->Type = E_SpriteType.Sprite; pSprite->Position.X = pos.X + AutoTransformOffset.X; pSprite->Position.Y = pos.Y + AutoTransformOffset.Y; pSprite->Position.Z = pos.Z + AutoTransformOffset.Z; pSprite->Size.X = sX; pSprite->Size.Y = sY; pSprite->Align = align; pSprite->RenderState = renderState; pSprite->PreTransformIndex = 0; pSprite->PostTransformIndex = AutoTransformIndex; pSprite->Colors = colors; if ((renderState.BlendState == E_BlendState.AlphaBlend) && !pSprite->Colors.PreMultipliedAlpha) { pSprite->Colors.ToPremultiplied(); } pSprite->Texture0.TextureIndex = -1; pSprite->Texture1.TextureIndex = -1; pSprite->Texture2.TextureIndex = -1; pSprite->BatchCount = 1; } RenderPassLayerSprites[renderPass][layer].Add(SpriteCount); CurrentSprite = SpriteCount++; }
public void AddSprite(int renderPass, int layer, float pX, float pY, float pZ, float sX, float sY, E_Align align, ref SpriteColors colors, ref RenderState renderState) { Vector3 p = new Vector3(pX, pY, pZ); AddSprite(renderPass, layer, ref p, sX, sY, align, ref colors, ref renderState); }
// WidgetBase public WidgetBase() { IsActive = true; IsSelected = true; Name = null; RenderPass = 0; Layer = 0; Position = new Vector3( 0.0f, 0.0f, 0.0f ); Size = new Vector3( 0.0f, 0.0f, 0.0f ); Scale = new Vector2( 1.0f, 1.0f ); Rotation = new Vector3( 0.0f, 0.0f, 0.0f ); Align = E_Align.TopLeft; ParentWidget = null; ParentAttach = E_Align.None; Children = new List< WidgetBase >(); Alpha = 1.0f; Intensity = 1.0f; ColorBaseName = null; ColorBase = Color.Magenta; RenderStateName = null; RenderState = new RenderState( (int)E_Effect.MultiTexture1, E_BlendState.AlphaBlend ); Textures = new List< SpriteTexture >(); Timelines = new List< Timeline >(); AlphaFinal = Alpha; IntensityFinal = Intensity; ColorFinal = ColorBase; Flags = (int)E_WidgetFlag.InheritAlpha | (int)E_WidgetFlag.InheritIntensity; TransformMatrix = Matrix.Identity; UpY = 1.0f; }
// GetVertexOffsetAligned public Vector2 GetVertexOffsetAligned( int renderPass, E_Align align ) { if ( IsRenderPass3D( renderPass ) ) return VertexOffsetAlignedFlipped[ (int)align ]; return VertexOffsetAligned[ (int)align ]; }
public void AddSprite( int renderPass, int layer, float pX, float pY, float pZ, float sX, float sY, E_Align align, ref SpriteColors colors, ref RenderState renderState ) { Vector3 p = new Vector3( pX, pY, pZ ); AddSprite( renderPass, layer, ref p, sX, sY, align, ref colors, ref renderState ); }
public unsafe void AddSprite( int renderPass, int layer, ref Vector3 pos, float sX, float sY, E_Align align, ref SpriteColors colors, ref RenderState renderState ) { if ( SpriteCount == SpriteCountMax ) return; fixed ( Sprite* pSprite = &Sprites[ SpriteCount ] ) { pSprite->Type = E_SpriteType.Sprite; pSprite->Position.X = pos.X + AutoTransformOffset.X; pSprite->Position.Y = pos.Y + AutoTransformOffset.Y; pSprite->Position.Z = pos.Z + AutoTransformOffset.Z; pSprite->Size.X = sX; pSprite->Size.Y = sY; pSprite->Align = align; pSprite->RenderState = renderState; pSprite->PreTransformIndex = 0; pSprite->PostTransformIndex = AutoTransformIndex; pSprite->Colors = colors; if ( ( renderState.BlendState == E_BlendState.AlphaBlend ) && !pSprite->Colors.PreMultipliedAlpha ) pSprite->Colors.ToPremultiplied(); pSprite->Texture0.TextureIndex = -1; pSprite->Texture1.TextureIndex = -1; pSprite->Texture2.TextureIndex = -1; pSprite->BatchCount = 1; } RenderPassLayerSprites[ renderPass ][ layer ].Add( SpriteCount ); CurrentSprite = SpriteCount++; }
// Process private Vector2 Process( ref StringProxy text, FontStyle fontStyle, int renderPass, int layer, ref Vector3 pos, float height, E_Align align, ref SpriteColors colors, float wrapSizeX ) { RenderPass = renderPass; Layer = layer; Position = pos; Align = align; Colors = colors; if ( ( fontStyle.RenderState.BlendState == E_BlendState.AlphaBlend ) && !Colors.PreMultipliedAlpha ) Colors.ToPremultiplied(); return Process( ref text, fontStyle, height, wrapSizeX, E_FontProcessType.Draw ); }
public Vector2 Draw( StringUI text, FontStyle fontStyle, int renderPass, int layer, ref Vector3 pos, float height, E_Align align, ref SpriteColors colors, float wrapSizeX ) { StringProxy stringProxy = new StringProxy( text ); return Process( ref stringProxy, fontStyle, renderPass, layer, ref pos, height, align, ref colors, wrapSizeX ); }
public Vector2 Draw(StringUI text, FontStyle fontStyle, int renderPass, int layer, ref Vector3 pos, float height, E_Align align, ref SpriteColors colors, float wrapSizeX) { StringProxy stringProxy = new StringProxy(text); return(Process(ref stringProxy, fontStyle, renderPass, layer, ref pos, height, align, ref colors, wrapSizeX)); }