PS2SDK
PS2 Homebrew Libraries
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
13#include "vux.h"
14
15
16
17
18
19
20
21VU_MATRIX VuWorldMatrix = {{
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
28VU_MATRIX VuViewMatrix = {{
29 {1.0f, 0.0f, 0.0f, 0.0f},
30 {0.0f, 1.0f, 0.0f, 0.0f},
31 {0.0f, 0.0f, 1.0f, 0.0f},
32 {0.0f, 0.0f, 0.0f, 1.0f}
33 }};
34
35VU_MATRIX VuPrjectionMatrix = {{
36 {1.0f, 0.0f, 0.0f, 0.0f},
37 {0.0f, 1.0f, 0.0f, 0.0f},
38 {0.0f, 0.0f, 1.0f, 0.0f},
39 {0.0f, 0.0f, 0.0f, 1.0f}
40 }};
41
42VU_MATRIX VuLocalScreenMatrix = {{
43 {1.0f, 0.0f, 0.0f, 0.0f},
44 {0.0f, 1.0f, 0.0f, 0.0f},
45 {0.0f, 0.0f, 1.0f, 0.0f},
46 {0.0f, 0.0f, 0.0f, 1.0f}
47 }};
48
49
50
51
52
53float vu_projection = 500.0f;
54int vu_projection_type = 0; //0=vu_projection , 1=VuPrjectionMatrix
55unsigned short vu_offset_x = 2048;
56unsigned short vu_offset_y = 2048;
57VU_FCVECTOR vu_light_ambient = {0.2f, 0.2f, 0.2f, 1.0f};
58float vu_fog_near = 25000.0f;
59float vu_fog_far = 45000.0f;
60float vu_near_plane_w = 300.0f;
61float vu_near_plane_h = 300.0f;
62
63
64
65
66
67
68
69
70void VuInit(void)
71{
72
73
74}
75
76
77
78void VuSetGeometryXYOffset(unsigned short x, unsigned short y)
79{
80
81 vu_offset_x = x;
82 vu_offset_y = y;
83}
84
85
86
87
88void VuSetProjection(float z)
89{
90
91 vu_projection = z;
92 vu_projection_type = 0;
93}
94
95
96
97
98void VuSetProjectionMatrix(const VU_MATRIX *projection)
99{
100 VuPrjectionMatrix = *projection;
101
102 vu_projection_type = 1; // use projection matrix
103}
104
105
106
107
108void VuSetProjectionType(unsigned int type)
109{
110 vu_projection_type = type;
111}
112
113
114
115
116void VuSetWorldMatrix(const VU_MATRIX *world)
117{
118
119 VuWorldMatrix = *world;
120}
121
122
123
124
125void VuSetViewMatrix(const VU_MATRIX *view)
126{
127
128 VuViewMatrix = *view;
129}
130
131
132
133
134
135void VuSetLocalScreenMatrix(const VU_MATRIX *m)
136{
137
138 VuLocalScreenMatrix = *m;
139}
140
141
142
143
144void VuSetProjectionNearPlaneWH(unsigned int w, unsigned int h)
145{
146
147 vu_near_plane_w = w;
148 vu_near_plane_h = h;
149}
150
151
152
153
154void VuSetAmbientLight(float r, float g, float b)
155{
156
157 vu_light_ambient.r = r;
158 vu_light_ambient.g = g;
159 vu_light_ambient.b = b;
160 vu_light_ambient.a = 1.0f;
161}