Repository navigation
Expand file tree
/
Copy pathrendernormal.c
More file actions
61 lines (52 loc) · 2.12 KB
/
Copy pathrendernormal.c
File metadata and controls
61 lines (52 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// BanjoDecomp: core2/code_5FB00.c
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void animVerticesList_setCoords(BKAnimVerticesList *this, BKVertexList *bk_vtx_list, s32 index, f32 coords[3]) {
Vtx *vtx, *vtx_list;
int i;
BKAnimVertices *anim_vertices;
vtx_list = vtxList_getVertices(bk_vtx_list);
// anim_vertices = this->data;
anim_vertices = (BKAnimVertices *) this->data;
while (index != 0) {
anim_vertices = (BKAnimVertices *) ((s16*)(anim_vertices + 1) + (anim_vertices->vtx_count - 1)); // TODO: Remove this ugly pointer calculation
index--;
}
for (i = 0; i < anim_vertices->vtx_count; i++) {
vtx = &vtx_list[anim_vertices->vtx_list[i]];
// vtx->v.ob[0] = coords[0];
vtx->v.ob[0] = (s16) (s32) coords[0];
// vtx->v.ob[1] = coords[1];
vtx->v.ob[1] = (s16) (s32) coords[1];
// vtx->v.ob[2] = coords[2];
vtx->v.ob[2] = (s16) (s32) coords[2];
}
}
void animVerticesList_transform(BKAnimVerticesList *this, BKVertexList *bk_vtx_list, AnimMtxList *mtx_list) {
Vtx *vtx, *vtx_list;
int j;
BKAnimVertices *anim_vertices;
s16 transformed_coords[3];
s32 mtx_index;
int i;
vtx_list = vtxList_getVertices(bk_vtx_list);
// anim_vertices = this->data;
anim_vertices = (BKAnimVertices *) this->data;
mtx_index = -2;
for(i = 0; i < this->count; i++) {
if (mtx_index != anim_vertices->anim_index) {
mtx_index = anim_vertices->anim_index;
mlMtxSet(animMtxList_get(mtx_list, mtx_index));
}
mlMtx_apply_vec3s(transformed_coords, anim_vertices->coord);
for (j = 0; j < anim_vertices->vtx_count; j++) {
vtx = &vtx_list[anim_vertices->vtx_list[j]];
vtx->v.ob[0] = transformed_coords[0];
vtx->v.ob[1] = transformed_coords[1];
vtx->v.ob[2] = transformed_coords[2];
}
anim_vertices = (BKAnimVertices *) ((s16*)(anim_vertices + 1) + (anim_vertices->vtx_count - 1)); // TODO: Remove this ugly pointer calculation
}
osWritebackDCache(vtx_list, vtxList_getVtxCount(bk_vtx_list) * sizeof(Vtx));
}