annotate col.cc @ 143:be127b7d1812

minor fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 23 Jul 2011 10:18:28 +0900
parents 8ac08eda80ac
children d1ddd095ab03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
1 #include <stdio.h>
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
2 #include"libps2.h"
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
3 #include"ps2util.h"
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
4 #include"col.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
5 #include"mytype.h"
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
6 #include <stdbool.h>
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
7 #include <string.h>
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
8
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
9 #include "gSprite.h"
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
10
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
11 extern Viewer *droot;
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
12
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 0
diff changeset
13 /**
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
14 * v0, v1が描く三角形と点pの内外判定(approx detection)
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
15 * 点pはv0, v1が描く面のどこかに位置している。
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
16 * pが面の三角形の外側にあるときTRUEを戻し、
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
17 * そうでなければFALSEを戻す。境界は含む。
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
18 */
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
19
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
20 bool
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
21 col_detect_approx(FVECTOR p, FVECTOR v0, FVECTOR v1)
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
22 {
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
23 float v_r1, v_r2, r1_r2, r1_r1, r2_r2;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
24 float a, b, r;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
25
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
26 v_r1 = ps2_vu0_inner_product( p, v0 );
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
27 v_r2 = ps2_vu0_inner_product( p, v1 );
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
28 r1_r2 = ps2_vu0_inner_product( v0, v1 );
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
29 r1_r1 = ps2_vu0_inner_product( v0, v0 );
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
30 r2_r2 = ps2_vu0_inner_product( v1, v1 );
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
31
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
32 a = (v_r1 * r2_r2 - v_r2 * r1_r2);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
33 b = (v_r2 * r1_r1 - v_r1 * r1_r2);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
34 r = (r1_r1 * r2_r2 - r1_r2 * r1_r2);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
35
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
36 return (a>=0 && b>=0 && a+b-r<=0) ? true : false;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
37 }
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
38
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
39
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
40
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
41 /**
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
42 * 垂心oの算出. 点pからv0, v1が描く面へ垂線を引いたときの交点oを
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
43 * 垂心(orthocenter)と呼ぶ。
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
44 */
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
45 //なんか一回も使われていないらしいので消す、はずだった
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
46 static void
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
47 col_orthocenter(FVECTOR o, FVECTOR p, FVECTOR p0, FVECTOR normal)
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
48 {
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
49 FVECTOR o0, d;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
50
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
51 ps2_vu0_sub_vector(o0, p, p0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
52 o0[W_AXIS] = 0;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
53 ps2_vu0_scale_vector(
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
54 d, normal, ps2_vu0_inner_product(o0, normal));
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
55
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
56 o[X_AXIS] = p[X_AXIS] - d[X_AXIS];
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
57 o[Y_AXIS] = p[Y_AXIS] - d[Y_AXIS];
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
58 o[Z_AXIS] = p[Z_AXIS] - d[Z_AXIS];
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
59 o[W_AXIS] = 1;
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
60 }
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
61
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
62
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
63 /**
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
64 * 点pと面との衝突(点pとdetection face面との垂心oがdetection face領域の
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
65 * 中にあるかを)判定衝突時(oがdetection face領域の外)はFALSEを戻し、そう
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
66 * でなければTRUE、 垂心(orthocenter)、垂心のある面の法線(normal
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
67 * vector)を戻す.
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
68 */
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
69 bool
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
70 col_detect(ColFaceHd* hd, FVECTOR pose, FVECTOR p)
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
71 {
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
72 FVECTOR o, o0;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
73 int i;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
74 ColFacePtr col_face=hd->colface;
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
75
142
8ac08eda80ac course rainbow
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 140
diff changeset
76
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
77 for (i=0; i<hd->facenum; i++) {
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
78
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
79 // * 垂心oを求める
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
80 col_orthocenter(o, p, col_face[i].p0, col_face[i].normal);
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
81
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
82 // * detection face上のある点p0から垂心oへのベクトルo0を求める
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
83 ps2_vu0_sub_vector(o0, o, col_face[i].p0);
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
84
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
85 // * ベクトルv0, v1の描く三角形とo0とで内外判定(range approx detection)を行う
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
86 if (col_detect_approx(o0, col_face[i].v0, col_face[i].v1)==true) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
87 goto NOCOLLISION;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
88 }
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
89 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
90 return false;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
91 NOCOLLISION:
143
be127b7d1812 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
92 printf("---on hd->facenum = %d/%d ----- ",i, hd->facenum);
be127b7d1812 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
93 printf("P x,y,z = %f,%f,%f ",col_face[i].p0[0],col_face[i].p0[1],col_face[i].p0[2]);
be127b7d1812 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
94 printf("N x,y,z = %f,%f,%f\n",col_face[i].normal[0],col_face[i].normal[1],col_face[i].normal[2]);
be127b7d1812 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
95
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
96 ps2_vu0_copy_vector(p, o);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
97 ps2_vu0_copy_vector(pose, col_face[i].normal);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
98 return true;
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
99
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
100 }
91
cb6c6de125dc halfway
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 90
diff changeset
101
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
102
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
103 /*
88
ce9ef7dcf2f0 convert UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
104 * detection face作成
126
030394675d8e succes compile
e085768
parents: 124
diff changeset
105 * Collision XML から Polygon を読み込んで、
030394675d8e succes compile
e085768
parents: 124
diff changeset
106 * Normal Vector(Polygon に直交した Vector) を生成する。
030394675d8e succes compile
e085768
parents: 124
diff changeset
107 * face の中に、既に Normal Vector が計算されているので、
030394675d8e succes compile
e085768
parents: 124
diff changeset
108 * それを利用してもよい。
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
109 */
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
110
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 88
diff changeset
111
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
112 void col_init(ColFaceHd* hd, char *colImg)
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
113 {
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
114 static int col_num = 0;
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
115
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
116 col_num ++;
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
117
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
118 // xmlから読み込み
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
119 call_createFromXMLfile(colImg);
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
120
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
121 char str[100];
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
122
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
123 sprintf(str,"hoge%d",col_num);
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
124
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
125 printf("%s\n",str);
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
126 printf("%d\n",col_num);
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
127
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
128 // SceneGraphPtr face = droot->createSceneGraph("hoge");
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
129 SceneGraphPtr face = droot->createSceneGraph(str);
128
d9e3137e70a0 xml name change
e085768
parents: 126
diff changeset
130
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
131 int i;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
132 FVECTOR p1, p2;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
133 ColFacePtr colface;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
134
139
dbf8858aceed malloc error in col.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
135 hd->facenum = face->size/3;
dbf8858aceed malloc error in col.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
136 malloc_align16(&hd->free_addr, &colface, sizeof(ColFace)*hd->facenum);
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
137
138
993d5f7e5f30 collision
e085768
parents: 130
diff changeset
138
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
139
124
e085768
parents: 99
diff changeset
140 for (i=0; i < hd->facenum; i++) {
126
030394675d8e succes compile
e085768
parents: 124
diff changeset
141 memcpy(colface[i].p0, &face->pp->tri[i].ver1, sizeof(FVECTOR));
030394675d8e succes compile
e085768
parents: 124
diff changeset
142 memcpy(p1, &face->pp->tri[i].ver3, sizeof(FVECTOR));
030394675d8e succes compile
e085768
parents: 124
diff changeset
143 memcpy(p2, &face->pp->tri[i].ver2, sizeof(FVECTOR));
030394675d8e succes compile
e085768
parents: 124
diff changeset
144
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
145 ps2_vu0_sub_vector(colface[i].v0, p1, colface[i].p0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
146 ps2_vu0_sub_vector(colface[i].v1, p2, colface[i].p0);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
147
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
148 ps2_vu0_outer_product(colface[i].normal, colface[i].v0, colface[i].v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
149 ps2_vu0_normalize(colface[i].normal, colface[i].normal);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
150
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
151 if (colface[i].normal[1] > 0) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
152 colface[i].normal[0] = -colface[i].normal[0];
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
153 colface[i].normal[1] = -colface[i].normal[1];
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
154 colface[i].normal[2] = -colface[i].normal[2];
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
155 }
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
156 }
130
4f50f5a3b363 new repository
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
157
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
158 hd->colface = colface;
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
159 }