OSDN Git Service

PR java/16789:
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.lang / Matrix4f.java
1 /*
2 * Instance initializers are now turned into a new function instinit$ and called
3 * from the ctor. SAVE_EXPRs can't be easily shared.
4 *
5 * Contributed by Adam King <aking@dreammechanics.com>
6 *
7 */
8
9 public class Matrix4f
10 {
11         public float m00;
12         public float m01;
13         public float m02;
14         public float m03;
15         public float m10;
16         public float m11;
17         public float m12;
18         public float m13;
19         public float m20;
20         public float m21;
21         public float m22;
22         public float m23;
23         public float m30;
24         public float m31;
25         public float m32;
26         public float m33;
27
28         private float scale;
29
30         static boolean initialized;
31         static Matrix4f xmat;
32         static Matrix4f ymat;
33         static Matrix4f zmat;
34         static Matrix4f tempMatrix1;
35         static Matrix4f tempMatrix2;
36
37         {
38                 if( !initialized )
39                 {
40                     System.out.println ("not initialized");
41                         initialized = true;
42                         xmat = new Matrix4f();
43                         ymat = new Matrix4f();
44                         zmat = new Matrix4f();
45                         tempMatrix1 = new Matrix4f();
46                         tempMatrix2 = new Matrix4f();
47                 }
48                 else { System.out.println ("initialized"); }
49                     
50         }
51
52         public Matrix4f()
53         {
54                 m00 = 1;
55                 m01 = 0;
56                 m02 = 0;
57                 m03 = 0;
58                 m10 = 0;
59                 m11 = 1;
60                 m12 = 0;
61                 m13 = 0;
62                 m20 = 0;
63                 m21 = 0;
64                 m22 = 1;
65                 m23 = 0;
66                 m30 = 0;
67                 m31 = 0;
68                 m32 = 0;
69                 m33 = 1;
70         }
71
72         public Matrix4f( float v[] )
73         {
74                 m00 = v[0];
75                 m01 = v[1];
76                 m02 = v[2];
77                 m03 = v[3];
78                 m10 = v[4];
79                 m11 = v[5];
80                 m12 = v[6];
81                 m13 = v[7];
82                 m20 = v[8];
83                 m21 = v[9];
84                 m22 = v[10];
85                 m23 = v[11];
86                 m30 = v[12];
87                 m31 = v[13];
88                 m32 = v[14];
89                 m33 = v[15];
90         }
91
92         public Matrix4f( float m00, float m01, float m02, float m03,
93                 float m10, float m11, float m12, float m13, 
94                 float m20, float m21, float m22, float m23, 
95                 float m30, float m31, float m32, float m33 )
96         {
97                 this.m00 = m00;
98                 this.m01 = m01;
99                 this.m02 = m02;
100                 this.m03 = m03;
101                 this.m10 = m10;
102                 this.m11 = m11;
103                 this.m12 = m12;
104                 this.m13 = m13;
105                 this.m20 = m20;
106                 this.m21 = m21;
107                 this.m22 = m22;
108                 this.m23 = m23;
109                 this.m30 = m30;
110                 this.m31 = m31;
111                 this.m32 = m32;
112                 this.m33 = m33;
113         }
114
115         public static void main( String[] args )
116         {
117             System.out.println( "Test main..." );
118             new Matrix4f ();
119             new Matrix4f (0,0,0,0,
120                           0,0,0,0,
121                           0,0,0,0,
122                           0,0,0,0);
123             new Matrix4f (new float [] {0,0,0,0,
124                                         0,0,0,0,
125                                         0,0,0,0,
126                                         0,0,0,0});
127         }
128 }
129