sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
vux.c
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# (c) 2009 Lion
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
11
#include <
libvux.h
>
12
#include <
stdlib.h
>
13
14
#include "
vux.h
"
15
16
17
18
19
20
21
static
const
VU_MATRIX
VuInitMatrix = {{
22
{1.0f, 0.0f, 0.0f, 0.0f},
23
{0.0f, 1.0f, 0.0f, 0.0f},
24
{0.0f, 0.0f, 1.0f, 0.0f},
25
{0.0f, 0.0f, 0.0f, 1.0f}
26
}};
27
VU_MATRIX
VuWorldMatrix;
28
VU_MATRIX
VuViewMatrix;
29
VU_MATRIX
VuPrjectionMatrix;
30
VU_MATRIX
VuLocalScreenMatrix;
31
32
float
vu_projection;
33
int
vu_projection_type;
//0=vu_projection , 1=VuPrjectionMatrix
34
unsigned
short
vu_offset_x;
35
unsigned
short
vu_offset_y;
36
VU_FCVECTOR
vu_light_ambient;
37
float
vu_fog_near;
38
float
vu_fog_far;
39
float
vu_near_plane_w;
40
float
vu_near_plane_h;
41
42
__attribute__
((constructor))
43
static
void
__VuInit_ctor(
void
)
44
{
45
VuInit();
46
}
47
48
void
VuInit(
void
)
49
{
50
VuSetWorldMatrix(NULL);
51
VuSetViewMatrix(NULL);
52
VuSetProjectionMatrix(NULL);
53
VuSetLocalScreenMatrix(NULL);
54
VuSetGeometryXYOffset(2048, 2048);
55
VuSetProjection(500.0f);
56
VuSetAmbientLight(0.2f, 0.2f, 0.2f);
57
vu_fog_near = 25000.0f;
58
vu_fog_far = 45000.0f;
59
VuSetProjectionNearPlaneWH(300.0f, 300.0f);
60
}
61
62
63
64
void
VuSetGeometryXYOffset(
unsigned
short
x,
unsigned
short
y)
65
{
66
67
vu_offset_x = x;
68
vu_offset_y = y;
69
}
70
71
72
73
74
void
VuSetProjection(
float
z)
75
{
76
77
vu_projection = z;
78
vu_projection_type = 0;
79
}
80
81
82
83
84
void
VuSetProjectionMatrix(
const
VU_MATRIX
*projection)
85
{
86
if
(!projection)
87
{
88
VuPrjectionMatrix = VuInitMatrix;
89
}
90
else
91
{
92
VuPrjectionMatrix = *projection;
93
}
94
95
vu_projection_type = 1;
// use projection matrix
96
}
97
98
99
100
101
void
VuSetProjectionType(
unsigned
int
type)
102
{
103
vu_projection_type = type;
104
}
105
106
107
108
109
void
VuSetWorldMatrix(
const
VU_MATRIX
*world)
110
{
111
if
(!world)
112
{
113
VuWorldMatrix = VuInitMatrix;
114
return
;
115
}
116
VuWorldMatrix = *world;
117
}
118
119
120
121
122
void
VuSetViewMatrix(
const
VU_MATRIX
*view)
123
{
124
if
(!view)
125
{
126
VuViewMatrix = VuInitMatrix;
127
return
;
128
}
129
VuViewMatrix = *view;
130
}
131
132
133
134
135
136
void
VuSetLocalScreenMatrix(
const
VU_MATRIX
*m)
137
{
138
if
(!m)
139
{
140
VuLocalScreenMatrix = VuInitMatrix;
141
return
;
142
}
143
VuLocalScreenMatrix = *m;
144
}
145
146
147
148
149
void
VuSetProjectionNearPlaneWH(
unsigned
int
w,
unsigned
int
h)
150
{
151
152
vu_near_plane_w = w;
153
vu_near_plane_h = h;
154
}
155
156
157
158
159
void
VuSetAmbientLight(
float
r,
float
g,
float
b)
160
{
161
162
vu_light_ambient.r = r;
163
vu_light_ambient.g = g;
164
vu_light_ambient.b = b;
165
vu_light_ambient.a = 1.0f;
166
}
libvux.h
stdlib.h
VU_FCVECTOR
Definition
libvux.h:89
VU_MATRIX
Definition
libvux.h:37
__attribute__
Definition
gif_registers.h:40
vux.h
core
libvux
src
vux.c
Generated by
1.18.0