Skip to main content

sky-data

source

Functions


init-cloud-vert-array

init-cloud-vert-array() => symbolsource

init-haze-vert-array

init-haze-vert-array() => symbolsource

sky-make-moon-data

sky-make-moon-data(arg0: sky-work, arg1: float) => nonesource

Initialize upload-data with sky-moon-data in sky-work

sky-make-sun-data

sky-make-sun-data(arg0: sky-work, arg1: int, arg2: float) => nonesource

Initialize upload-data with sky-sun-data in sky-work

Variables


*cloud-poly*

*cloud-poly*: inline-arraysource

*cloud-vert-array*

*cloud-vert-array*: cloud-vert-arraysource

*haze-poly*

*haze-poly*: inline-arraysource

*haze-vert-array*

*haze-vert-array*: haze-vert-arraysource

*sky-work*

*sky-work*: sky-worksource

sky-base-polygons

sky-base-polygons: inline-arraysource

sky-roof-polygons

const sky-roof-polygons: inline-arraysource

Types


cloud-lights

cloud-lights: structuresource
Fields
sun0-normal: vector
sun1-normal: vector
moon-normal: vector
ambi-color: vector
ambi-color-lower: vector
sun0-color: vector
sun1-color: vector
moon-color: vector
sun0-color-lower: vector
sun0-scale: float
sun1-scale: float
moon-scale: float

cloud-vert-array

cloud-vert-array: structuresource
Fields
data: cloud-vertex

cloud-vertex

cloud-vertex: structuresource
Fields
pos: vector
stq: vector
col: vector
nrm: vector
stq2: vector
col2: vector
nrm2: vector

haze-lights

haze-lights: structuresource
Fields
sun0-normal: vector
sun1-normal: vector
moon-normal: vector
ambi-color: vector
sun0-color: vector
sun1-color: vector
moon-color: vector
sun0-scale: float
sun1-scale: float
moon-scale: float

haze-vert-array

haze-vert-array: structuresource
Fields
data: haze-vertex

haze-vertex

haze-vertex: structuresource
Fields
pos: vector
nrm: vector
col: vector

sky-color-day

sky-color-day: structuresource
Fields
hour: sky-color-hour

sky-color-hour

sky-color-hour: structuresource
Fields
snapshot1: int32
snapshot2: int32
morph-start: float
morph-end: float

sky-moon-data

sky-moon-data: structuresource
Fields
data: uint128
pos: vector
scale: vector

sky-orbit

sky-orbit: structuresource
Fields
high-noon: float
tilt: float
rise: float
dist: float
min-halo: float
max-halo: float

sky-sun-data

sky-sun-data: structuresource
Fields
data: uint128
pos: vector
r-sun: float
r-halo: float
r-aurora: float
c-sun-start: rgba
c-sun-end: rgba
c-halo-start: rgba
c-halo-end: rgba
c-aurora-start: rgba
c-aurora-end: rgba

sky-upload-data

sky-upload-data: structuresource
Fields
data: uint128
sun: sky-sun-data
moon: sky-moon-data

sky-vertex

sky-vertex: structuresource
Fields
pos: vector
stq: vector
col: vector

sky-work

sky-work: structuresource
Fields
adgif-tmpl: dma-gif-packet
draw-tmpl: dma-gif-packet
draw-tmpl2: dma-gif-packet
fog-tmpl: dma-gif-packet
blend-tmpl: dma-gif-packet
sprite-tmpl: dma-gif-packet
sprite-tmpl2: dma-gif-packet
sun-coords: vector
green-coords: vector
moon0-coords: vector
moon1-coords: vector
moon2-coords: vector
star-coords: vector
sun-colors: vector4w
green-colors: vector4w
moon-colors: vector4w
star-colors: vector4w
st-coords: vector
random: vector4w
giftag-base: dma-gif
giftag-haze: dma-gif
giftag-roof: dma-gif
giftag-ocean: dma-gif
fog: vector
sky: float
time: float
off-s: uint16
off-t: uint16
orbit: sky-orbit
upload-data: sky-upload-data
ambi-color: vector4w
ambi-color-lower: vector4w
sun0-color: vector4w
sun1-color: vector4w
moon-color: vector4w
sun0-color-lower: vector4w
cam-mat: matrix
star-mat: matrix
vec0: vector4w
vec1: vector4w
cloud-lights: cloud-lights
haze-lights: haze-lights
buf: dma-buffer
draw-vortex: basic
stars: vector
Methods
init-sun-data!(obj: sky-work, arg0: int, arg1: float, arg2: float, arg3: float) => nonesource

Sets the sun related upload data - the sun, halo and aurora

init-orbit-settings!(obj: sky-work, arg0: int, arg1: float, arg2: float, arg3: float, arg4: float, arg5: float, arg6: float) => nonesource
update-colors-for-time(obj: sky-work, arg0: float) => nonesource

Update sky colors for the given time.

update-time-and-speed(obj: sky-work, arg0: float, arg1: float) => nonesource

Update based on the given time. Time is used to place suns/moon at the right spot, speed is used to scroll clouds.

draw(obj: sky-work) => nonesource
update-matrix(obj: sky-work, arg0: matrix) => nonesource

Update the projection matrix for sky drawing.
The input matrix should not include perepctive.
This function will apply the current math camera's perspective.

update-template-colors(obj: sky-work) => nonesource

Update skybox colors from level/mood.

init-regs-for-large-polygon-draw: unknown
init-regs-for-sky-asm: unknown
cloud-vtx-light-update(obj: sky-work, arg0: vector, arg1: vector, arg2: cloud-lights, arg3: vector, arg4: vector) => nonesource

Update lighting for cloud mesh vertex.

cloud-vtx-tex-update(obj: sky-work, arg0: vector, arg1: vector, arg2: vector, arg3: cloud-lights) => nonesource

Update texture stq for cloud mesh vertex.

adjust-cloud-lighting(obj: sky-work) => nonesource

Apply lighting to cloud vertices

cloud-vtx1-to-sky(obj: sky-work, arg0: sky-vertex, arg1: cloud-vertex) => nonesource

Convert a cloud vertex to a sky vertex, using the 'normal' stq/col

cloud-vtx2-to-sky(obj: sky-work, arg0: sky-vertex, arg1: cloud-vertex) => nonesource

Convert a cloud vertex to a sky vertex, using the '2' stq/col

draw-clouds(obj: sky-work, arg0: dma-buffer) => nonesource

Draw the cloud layer using large polygon renderer
Assumes that init-regs-for-large-polygon-draw was already called.

apply-haze-light(obj: sky-work, arg0: vector, arg1: vector, arg2: haze-lights) => nonesource

Apply haze lights to a vertex.

adjust-haze-lighting(obj: sky-work) => nonesource

Adjust lighting for haze.

haze-vtx-to-sky(obj: sky-work, arg0: sky-vertex, arg1: sky-vertex, arg2: haze-vertex) => nonesource

Convert haze vertex to sky format.

draw-haze(obj: sky-work, arg0: dma-buffer) => nonesource

Draw haze using large polygon renderer.
Calls init-regs-for-large-polygon-draw.

sun-dma: unknown
green-sun-dma: unknown
moon-dma: unknown
setup-stars(obj: sky-work, arg0: matrix, arg1: sky-upload-data) => nonesource

Prepare for star drawing.

stars-transform-asm: unknown
stars-dma: unknown
draw-roof(obj: sky-work, arg0: dma-buffer) => nonesource

Draw the roof of the sky box. Uses large-polygon renderer.

draw-base(obj: sky-work, arg0: dma-buffer) => nonesource

Draw the base of the sky box. Uses large-polygon renderer.

draw-fog(obj: sky-work, arg0: dma-buffer) => nonesource

sky-tng

source
Expand description

Sky renderer.

this render is much more complicated than the jak 1 version.

there's a lot of weird tricks to store values in the VF registers, and a lot of asm,

so a lot of this is in C++.



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Large Polygon Renderer

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



there's a special "large polygon renderer" that handles clipping

and ps2-specific texture perspective stuff.

the way it subdivides is extremely strange, and not well understood, but it works well with the

Direct renderer in C++.

this renderer is also used for drawing debug regions and some parts of the ocean near the horizon.



there's a lot of state stored in vf registers, so we have to be very careful with this.



VF registers for large polygon

vf13: fog

vf14: hmge

vf23: 0?

vf24: texture offset (stored in xy, zw are 0),

vf25: hvdf-offset

vf26: inv-hmge

vf27: giftag

vf28: cam 3 (premultiplied by hmge)

vf29: cam 2 (premultiplied by hmge)

vf30: cam 1 (premultiplied by hmge)

vf31: cam 0 (premultiplied by hmge)

Functions


close-sky-buffer

close-sky-buffer(arg0: dma-buffer) => nonesource

Terminate dma from large polygon renderer. This should be called after the last
call to render-sky-tri/quad.