Legacy:UnrealTournament Extension Pack/XtCanvasUtil - Unreal Wiki

# Legacy:UnrealTournament Extension Pack/XtCanvasUtil

### From Unreal Wiki, The Unreal Engine Documentation Site

< Legacy:UnrealTournament Extension Pack
Object_(UT) >> xtMainUtil >> xtCanvasUtil (Package: xtCore.u)

## About/Description

This advanced Util provides complex canvas related functions. They either extend common canvas functions or are completely new.

Class Name | xtCanvasUtil.uc
Type/Perpose | Global Canvas Functions providing class
Topics | Canvas, HUD, Drawing, Simulated Post Processing
Superclass | [[UnrealTournament_Extension_Pack/xtMainUtil | xtMainUtil]]
Subclasses
Current Version | v1.15
Current Function Count | 16
Author | Shadow

## Functions

### Advanced Canvas Functions (12 Functions)

static final function DrawRLSTexture(Canvas C,texture T, float Scale)
  Draws a relatively scaled texture T by Scale using DrawTile.

static final function DrawBox(Canvas C,texture T, float Height, float Width)
  Draws a 2D Canvas Box based on texture T, the Height and Width.

static final function Color SetColor(byte R, byte G, byte B, optional byte A)
  Sets a custom color by the 4 components. Similar to Vect2, Rot2 etc.

static function Color SetColorPercentage(color Source,color Final,float Percentage)
  Returns a new custom color between the range of Source and Final determined by Percentage in percent.

static final function bool ColorRGBIsZero(byte R,byte G,byte B,bool bAlpha,optional byte A)
  Returns whether the input components of some color would build up a zero-color value (true) or not (false).

static final function bool GetBounding2DBox(float pX,float pY,float X,float Y,float Width,float Height)
  Builds up an abstract 2D Canvas Box based on Width and Height positioned by the Center X and Y. Returns whether pX/pY are within the box (true) or not (false).

static final function bool MapToHud(canvas C,out vector Result,rotator ViewRotation,float FOV,vector TargetDir)
  Source: MapToHUD

static final function vector WorldToScreen(canvas C,vector WorldVector)
  Source: WorldToScreen

static simulated function bool WorldToScreen2(vector Worldvector,pawn Dude,vector Eyes,rotator Rot,float width,float Height,out float X,out float Y)
  Source: WorldToScreen Alternate Version

static final function vector ScreenToWorld(canvas C,actor Owner,float X,float Y,float Width,float Height,int FOV,rotator R,float EyeHeight,vector Location)
  Converts X/Y Canvas Coordinates into 3D Vector Positions (just the inversion of WorldToScreen).

static final function SetVectPos(canvas C,texture T,float MainScale,float UScale,float VScale,float X,float Y,float Length,bool bSeperated,bool bRealMode,optional actor A,optional actor B)
  Complex canvas positioning function. Sets SetPos relative to a world vector with auto correction of the position. The new Coronas make heavy use of it while allowing seperated tiling and scaling without loosing exact position on screen relative to the location. Texture T is the texture to be drawn (needs the USize/VSize values written in the texture) and placed. MainScale is the relative scale that scales both UScale and VScale relatively. U- and VScale are the seperated scales if bSeperated = True (U/VScale in Pixels). X/Y are the converted canvas positions. Length is the size of the converted vector. bRealMode determines whether the "Canvas Sprite" is scaled down or not either simulating a corona or a sprite. Actors A and B are needed for distance calculations for bRealMode = true.

static final function DrawAdvTile(canvas C,texture T,float MainScale,float UScale,float VScale,float UPan,float VPan,int MainTile,int UTile,int VTile,bool bSeperatedScaling,bool bSeperatedTiling,bool bRealMode,optional actor A,optional actor B)
  Very extended DrawTile Function. Draws a Canvas Texture on the screen to simulate the effect of a 3D Object (3D Sprite, 3D Corona ..) by working together with SetVectPos. It's absolutely essential for such effects like SoftwareShaderCoronas or -Sprites. Texture T is the dynamicly placed, scaled, colored (...) texture to be drawn. MainScale is the relative scale that scales both U- and VScale, if bSeperatedScaling = False. UScale and VScale are the seperated scales of the texture T if bSeperatedScaling = True (U/VScale in Pixels). UPan and VPan are the panning values of the texture T. MainTile is the relative tile for U- and VTile, if bSeperatedTiling = False. For example MainTile = 2, U/VTile are both 2, thus a 2/2 tiled texture. U- and VTile are the seperated tiling values if bSeperatedTiling = True. bRealMode determines whether the "Canvas Sprite" is scaled down or not either simulating a corona or a sprite. Actors A and B are needed for distance calculations for bRealMode = true.

### New Drawing Functions (4 Textures)

static final function DrawCorona(canvas C,xtShaderCorona xS)
  Draws a fully dynamic Corona controlled by any xtShaderCorona xS. These Coronas can be moved, attached, triggered, flickering, blinking, changing color dynamicly, being scaled by U/VScale, being tiled by U/V Tile, being panned by U/VPan and much more. Also Combiners (up to max. 3, thus 4 combined Textures: Corona + 3 Combiners) are supported distorting the Diffuse Corona Map and producing a combined Corona Texture for even more effects.

static final function DrawSprite(canvas C,xtShaderSprite xS)
  Draws a fully dynamic Sprite controlled by any xtShaderSprite xS. These Sprites can be moved, attached, triggered, flickering, blinking (as already common) but also changing color dynamicly, being scaled by U/VScale, being tiled by U/V Tile, being panned by U/VPan and much more. Also Combiners (up to max. 3, thus 4 combined Textures: Sprite + 3 Combiners) are supported distorting the Diffuse Sprite Map and producing a combined Sprite for even more effects.

static final function DrawLensflares(canvas C,xtLensflare xL)
  Draws fully dynamic 8-color-lens-based Lensflares controlled by any xtLensflare xL. They've the same properties like the new Coronas.

static final function RenderToTexture(canvas C,xtPortalManager xR,int Mode)
  Complex Canvas Function. Introduces Partial RenderToTexture. Is able to build up a dynamic Portal on the Screen (Mode = 0), as Corona (Mode = 1) or as Sprite (Mode = 2). Working on a native version for this to make it fully texture-based rather then Canvas-based.

Category:Legacy Custom Class (UT) \\

Category: Legacy Custom Class (UT)

##### Views

- Legacy
- Discussion
- Current revision

##### Search