coastline 0.0.4
Loading...
Searching...
No Matches
texrect.h File Reference

The textures of the interface and their drawing as rectangles of the screen. More...

#include <PR/ultratypes.h>
Include dependency graph for texrect.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Texture
 A compressed texture of the cartridge and the memory it is loaded into. More...

Typedefs

typedef void *(* AssetAllocator) (u32 size)
 An allocator of memory for a loaded asset.

Enumerations

enum  {
  TEXRECT_BLEND_TEXTURE , TEXRECT_BLEND_COLOR_THROUGH_TEXTURE , TEXRECT_BLEND_TEXTURE_2 , TEXRECT_BLEND_SHADED ,
  TEXRECT_BLEND_SHADED_OPAQUE
}
 How DrawTexturedRect() combines the texels with its colors. More...

Functions

void AllocAndDmaLoadAsset (Texture *texture, AssetAllocator alloc)
 Allocate memory for an uncompressed texture and copy it there from the cartridge.
void LoadAndDecompressAsset (Texture *texture, AssetAllocator alloc)
 Allocate memory for a texture and decompress it there from the cartridge.
void DrawTexturedRect (Texture *texture, s32 x, s32 y, s32 width, s32 height, s32 primRed, s32 primGreen, s32 primBlue, s32 primAlpha, s32 envRed, s32 envGreen, s32 envBlue, s32 envAlpha, s32 blendMode)
 Draw a texture over a rectangle of the screen, in strips that fit the texture memory, upside down.
void GetTextureScaleAndMask (u32 size, s32 *scale, s32 *maskBits)
 Get the texture coordinate scale of a texture side, and the bits of the mask that wraps it.
void DrawRedIntensityRect (u8 *texture, s32 width, s32 height, s32 x, s32 y, s32 drawWidth, s32 drawHeight)
 Draw a texture stretched over a rectangle and upside down, shaded from black to red by its intensity.
void DrawColoredTexturedRect (u8 *texture, s32 width, s32 height, s32 x, s32 y, s32 drawWidth, s32 drawHeight, s32 red, s32 green, s32 blue)
 Draw a colour through a texture stretched over a rectangle and upside down, with the intensity of the texture as its opacity.

Detailed Description

The textures of the interface and their drawing as rectangles of the screen.

Typedef Documentation

◆ AssetAllocator

typedef void *(* AssetAllocator) (u32 size)

An allocator of memory for a loaded asset.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

How DrawTexturedRect() combines the texels with its colors.

Enumerator
TEXRECT_BLEND_TEXTURE 

The texels as they are, blended over the picture.

TEXRECT_BLEND_COLOR_THROUGH_TEXTURE 

The primitive color through the texels as a mask.

TEXRECT_BLEND_TEXTURE_2 

The same as TEXRECT_BLEND_TEXTURE.

TEXRECT_BLEND_SHADED 

The texels shading from the primitive to the environment color.

TEXRECT_BLEND_SHADED_OPAQUE 

The same shading, opaque, alpha times shade.

Function Documentation

◆ AllocAndDmaLoadAsset()

void AllocAndDmaLoadAsset ( Texture * texture,
AssetAllocator alloc )

Allocate memory for an uncompressed texture and copy it there from the cartridge.

Parameters
textureThe texture to load.
allocThe allocator of the memory.
Ghidra address:
USA: 0x8023df00
Ghidra address:
Asia: 0x8023DA50
Ghidra address:
EUR: 0x8023f410
Ghidra address:
JPN: 0x8023ef10

◆ LoadAndDecompressAsset()

void LoadAndDecompressAsset ( Texture * texture,
AssetAllocator alloc )

Allocate memory for a texture and decompress it there from the cartridge.

Parameters
textureThe texture to load.
allocThe allocator of the memory.
Ghidra address:
USA: 0x8023df4c
Ghidra address:
Asia: 0x8023DA9C
Ghidra address:
EUR: 0x8023f45c
Ghidra address:
JPN: 0x8023ef5c

◆ DrawTexturedRect()

void DrawTexturedRect ( Texture * texture,
s32 x,
s32 y,
s32 width,
s32 height,
s32 primRed,
s32 primGreen,
s32 primBlue,
s32 primAlpha,
s32 envRed,
s32 envGreen,
s32 envBlue,
s32 envAlpha,
s32 blendMode )

Draw a texture over a rectangle of the screen, in strips that fit the texture memory, upside down.

The width counts without its sign. The blend mode picks how the primitive and the environment colors and the texels combine.

Parameters
textureThe loaded texture.
xThe left edge, in pixels of the low-resolution screen.
yThe top edge, in pixels of the low-resolution screen.
widthThe width, in pixels of the low-resolution screen.
heightThe height, in pixels of the low-resolution screen.
primRedThe red component of the primitive color, from 0 to 255.
primGreenThe green component of the primitive color, from 0 to 255.
primBlueThe blue component of the primitive color, from 0 to 255.
primAlphaThe alpha component of the primitive color, from 0 to 255.
envRedThe red component of the environment color, from 0 to 255.
envGreenThe green component of the environment color, from 0 to 255.
envBlueThe blue component of the environment color, from 0 to 255.
envAlphaThe alpha component of the environment color, from 0 to 255.
blendModeOne of the TEXRECT_BLEND_ values.
Ghidra address:
USA: 0x8023df9c
Ghidra address:
Asia: 0x8023DAEC
Ghidra address:
EUR: 0x8023f4ac
Ghidra address:
JPN: 0x8023efac

◆ GetTextureScaleAndMask()

void GetTextureScaleAndMask ( u32 size,
s32 * scale,
s32 * maskBits )

Get the texture coordinate scale of a texture side, and the bits of the mask that wraps it.

A side of more than 1024 texels is reported on the debug display and leaves the mask unset.

Parameters
sizeThe length of the side, in texels.
scaleReceives the texture coordinate scale.
maskBitsReceives the number of bits of the mask.
Ghidra address:
USA: 0x80217614
Ghidra address:
Asia: 0x80217164
Ghidra address:
EUR: 0x80218634
Ghidra address:
JPN: 0x80217f84
Ghidra address:
BRD3D: 0x10031347
Ghidra address:
BRGlide: 0x1002a9f7

◆ DrawRedIntensityRect()

void DrawRedIntensityRect ( u8 * texture,
s32 width,
s32 height,
s32 x,
s32 y,
s32 drawWidth,
s32 drawHeight )

Draw a texture stretched over a rectangle and upside down, shaded from black to red by its intensity.

Nothing calls it.

Parameters
textureThe texels, 4-bit intensities.
widthThe width of the texture, in texels.
heightThe height of the texture, in texels.
xThe left edge, in pixels of the low-resolution screen.
yThe top edge, in pixels of the low-resolution screen.
drawWidthThe width drawn, in pixels of the low-resolution screen, without its sign.
drawHeightThe height drawn, in pixels of the low-resolution screen.
Ghidra address:
USA: 0x80239220
Ghidra address:
Asia: 0x80238D70
Ghidra address:
EUR: 0x8023a730
Ghidra address:
JPN: 0x8023a230

◆ DrawColoredTexturedRect()

void DrawColoredTexturedRect ( u8 * texture,
s32 width,
s32 height,
s32 x,
s32 y,
s32 drawWidth,
s32 drawHeight,
s32 red,
s32 green,
s32 blue )

Draw a colour through a texture stretched over a rectangle and upside down, with the intensity of the texture as its opacity.

A negative drawn width also mirrors it. Nothing calls it.

Parameters
textureThe texels, 4-bit intensities.
widthThe width of the texture, in texels.
heightThe height of the texture, in texels.
xThe left edge, in pixels of the low-resolution screen.
yThe top edge, in pixels of the low-resolution screen.
drawWidthThe width drawn, in pixels of the low-resolution screen, negative to mirror.
drawHeightThe height drawn, in pixels of the low-resolution screen.
redThe red component of the colour, from 0 to 255.
greenThe green component of the colour, from 0 to 255.
blueThe blue component of the colour, from 0 to 255.
Ghidra address:
USA: 0x80239750
Ghidra address:
Asia: 0x802392A0
Ghidra address:
EUR: 0x8023ac60
Ghidra address:
JPN: 0x8023a760