@@ -156,18 +156,6 @@ public GLMatrix setGeneralizedPerspectiveProjectionMatrix(final GLVector lowerLe
156156 GLVector vb = lowerRight .minus (eye );
157157 GLVector vc = upperLeft .minus (eye );
158158
159- // if (va.cross(vc).times(vb) < 0.0f) {
160- // mirror points along the z axis (most users
161- // probably expect the x axis to stay fixed)
162- // vu = vu.times(-1.0f);
163- // pa = pc;
164- // pb = pa.plus(vr);
165- // pc = pa.plus(vu);
166- // va = pa.minus(eye);
167- // vb = pb.minus(eye);
168- // vc = pc.minus(eye);
169- // }
170-
171159 vr .normalize ();
172160 vu .normalize ();
173161 GLVector vn = vr .cross (vu ).normalize ();
@@ -205,114 +193,6 @@ public GLMatrix setGeneralizedPerspectiveProjectionMatrix(final GLVector lowerLe
205193 return this ;
206194 }
207195
208- public GLMatrix setGeneralizedPerspectiveProjectionMatrixUnity (final GLVector lowerLeft , final GLVector lowerRight ,
209- final GLVector upperLeft ,
210- final GLVector eye ,
211- final float near , final float far ) {
212-
213- GLVector pa = lowerLeft ;
214- GLVector pb = lowerRight ;
215- GLVector pc = upperLeft ;
216-
217- GLVector vr = pb .minus (pa );
218- GLVector vu = pc .minus (pa );
219-
220- GLVector va = pa .minus (eye );
221- GLVector vb = pb .minus (eye );
222- GLVector vc = pc .minus (eye );
223-
224- if (va .cross (vc ).times (vb ) < 0.0f ) {
225- // mirror points along the z axis (most users
226- // probably expect the x axis to stay fixed)
227- vu = vu .times (-1.0f );
228- pa = pc ;
229- pb = pa .plus (vr );
230- pc = pa .plus (vu );
231- va = pa .minus (eye );
232- vb = pb .minus (eye );
233- vc = pc .minus (eye );
234- }
235-
236- vr .normalize ();
237- vu .normalize ();
238- GLVector vn = vr .cross (vu ).normalize ();
239-
240- float distance = -1.0f * va .times (vn );
241-
242- float left = vr .times (va ) * near / distance ;
243- float right = vr .times (vb ) * near / distance ;
244- float bottom = vu .times (va ) * near / distance ;
245- float top = vu .times (vc ) * near / distance ;
246-
247- FloatUtil .makeFrustum (mMatrix , 0 , true , left , right , bottom , top , near , far );
248-
249- final GLMatrix mt = new GLMatrix (new float []{
250- vr .x (), vr .y (), vr .z (), 0.0f ,
251- vu .x (), vu .y (), vu .z (), 0.0f ,
252- vn .x (), vn .y (), vn .z (), 0.0f ,
253- 0.0f , 0.0f , 0.0f , 1.0f }).transpose ();
254-
255- this .mult (mt );
256- this .translate (eye .times (-1.0f ));
257-
258- return this ;
259- }
260-
261- private GLMatrix setFrustumLH (float left , float right , float bottom , float top , float near , float far ) {
262- float x = (2.0f *near ) / (right -left );
263- float y = (2.0f *near ) / (top -bottom );
264- float a = (right +left ) / (right -left );
265- float b = (top +bottom ) / (top -bottom );
266- float c = -(far +near ) / ( far -near );
267- float d = -(2.0f *far *far ) / (far -near );
268-
269- float [] m = new float []{
270- -x , 0.0f , a , 0.0f ,
271- 0.0f , -y , b , 0.0f ,
272- 0.0f , 0.0f , -c , -d ,
273- 0.0f , 0.0f , 1.0f , 0.0f ,
274- };
275-
276- System .arraycopy (m , 0 , mMatrix , 0 , mMatrix .length );
277-
278- return this ;
279- }
280-
281-
282- public GLMatrix setGeneralizedPerspectiveProjectionMatrix2 (final GLVector lowerLeft , final GLVector lowerRight ,
283- final GLVector upperLeft ,
284- final GLVector eye ,
285- final float near , final float far ) {
286-
287- final GLVector Xs = lowerRight .minus (lowerLeft );
288- final GLVector Ys = upperLeft .minus (lowerLeft );
289- final GLVector Zs = Xs .cross (Ys );
290-
291- final GLVector Es = eye .minus (lowerLeft );
292-
293- float distance = Es .times (Zs );
294- float width = lowerLeft .minus (lowerRight ).magnitude ();
295- float height = upperLeft .minus (lowerLeft ).magnitude ();
296-
297- float left = -Es .times (Xs ) * near / distance ;
298- float right = (width - Es .times (Xs )) * near / distance ;
299- float bottom = Es .times (Ys ) * near / distance ;
300- float top = (height - Es .times (Ys )) * near / distance ;
301-
302- FloatUtil .makeFrustum (mMatrix , 0 , true , left , right , bottom , top , near , far );
303-
304- final GLMatrix mt = new GLMatrix (new float []{
305- Xs .x (), Xs .y (), Xs .z (), 0.0f ,
306- Ys .x (), Ys .y (), Ys .z (), 0.0f ,
307- Zs .x (), Zs .y (), Zs .z (), 0.0f ,
308- 0.0f , 0.0f , 0.0f , 1.0f }).transpose ();
309-
310- this .mult (mt );
311- this .translate (eye .times (1.0f ));
312-
313- return this ;
314- }
315-
316196 public GLMatrix setFrustumProjectionMatrix (final float top , final float bottom ,
317197 final float left , final float right , final float near , final float far ) {
318198
0 commit comments