23
23
* Draws box along the axis
24
24
*/
25
25
public class AxisBox extends Object3D {
26
- int color = 0xFFFF3233 ;
26
+ int color = 0xFF1010FF ;
27
27
public AxisBox () {
28
28
mType = 1 ;
29
29
}
@@ -91,11 +91,19 @@ public void render(Scene3D s, float[] zbuff, int[] img, int w, int h) {
91
91
int p2 = index [i + 1 ];
92
92
int p3 = index [i + 2 ];
93
93
94
- boolean back = Scene3D .isBackface (
94
+ boolean front = Scene3D .isBackface (
95
95
tVert [p1 ], tVert [p1 + 1 ], tVert [p1 + 2 ],
96
96
tVert [p2 ], tVert [p2 + 1 ], tVert [p2 + 2 ],
97
97
tVert [p3 ], tVert [p3 + 1 ], tVert [p3 + 2 ]);
98
- if (back ) continue ;
98
+ if (front ) {
99
+ Scene3D .drawline (zbuff , img , color , w , h ,
100
+ tVert [p1 ], tVert [p1 + 1 ], tVert [p1 + 2 ] - 0.01f ,
101
+ tVert [p2 ], tVert [p2 + 1 ], tVert [p2 + 2 ] - 0.01f );
102
+ Scene3D .drawline (zbuff , img , color , w , h ,
103
+ tVert [p1 ], tVert [p1 + 1 ], tVert [p1 + 2 ] - 0.01f ,
104
+ tVert [p3 ], tVert [p3 + 1 ], tVert [p3 + 2 ] - 0.01f );
105
+ continue ;
106
+ }
99
107
100
108
Scene3D .drawline (zbuff , img , color , w , h ,
101
109
tVert [p1 ], tVert [p1 + 1 ], tVert [p1 + 2 ] - 0.01f ,
@@ -113,9 +121,6 @@ public void render(Scene3D s, float[] zbuff, int[] img, int w, int h) {
113
121
tVert [p3 ], tVert [p3 + 1 ], tVert [p3 + 2 ] - 0.01f ,
114
122
tVert [p2 ]-tVert [p1 ], tVert [p2 + 1 ]-tVert [p1 +1 ], tVert [p2 + 2 ] -tVert [p1 +2 ]);
115
123
116
- // Scene3D.drawline(zbuff, img,0x000000, w, h,
117
- // tVert[p2], tVert[p2 + 1], tVert[p2 + 2] - 0.01f,
118
- // tVert[p3], tVert[p3 + 1], tVert[p3 + 2] - 0.01f);
119
124
}
120
125
}
121
126
public static void drawTicks (float [] zbuff , int [] img , int color , int w , int h ,
@@ -155,11 +160,11 @@ void raster_color(Scene3D s, float[] zbuff, int[] img, int w, int h) {
155
160
VectorUtil .triangleNormal (tVert , p1 , p3 , p2 , s .tmpVec );
156
161
float ss = VectorUtil .dot (s .tmpVec , screen );
157
162
float defuse = VectorUtil .dot (s .tmpVec , s .mTransformedLight );
158
- float ambient = 0.3f ;
163
+ float ambient = 0.5f ;
159
164
160
165
float bright = Math .min (Math .max (0 , defuse + ambient ), 1 );
161
- float hue = 0.2f ;
162
- float sat = 0.5f ;
166
+ float hue = 0.4f ;
167
+ float sat = 0.1f ;
163
168
164
169
int col = Scene3D .hsvToRgb (hue , sat , bright );
165
170
Scene3D .triangle (zbuff , img , col , w , h , tVert [p1 ], tVert [p1 + 1 ],
0 commit comments