setTranslate(-1,0,0); setScale (10,5,10); setTranslate(1,0,0)would have the effect of translating, then scaling, then translating back. The same applies for the setRotate and setMatrix calls. The setRotate call takes an array of 4 doubles. The first 3 doubles represent an axis around which to rotate (unnormalized) and the fourth double is the angle to rotate in degrees (be careful if you're using the Vecmath AxisAngle4d, as this takes an angle in radians). The setMatrix call takes an array of 16 doubles and represents a transformation matrix in row-major order (the first 4 values are the first row, next 4 values are the second row, and so on).
Parser parser = new Parser();
parser.setImplementation(cs418.parser.interface.Mesh.class, OurMeshImplementation.class); parser.setImplementation(cs418.parser.interface.Sphere.class, OurSphereImplementation.class); parser.setImplementation(cs418.parser.interface.Phong.class, OurPhongImplementation.class); ...You can, of course, have more reasonable names for your classes. You can even reuse the name Mesh, for example, as long as you are careful about fully qualifying the name in your code. The .class in the above method calls may be something you have not seen before. Every class and interface in Java has an implicit class field which is a Class object representing the class. The parser needs these class objects in order to be able to call the right constructors and appropriate accessor methods (an accessor method is a method with a name like setFoo or getFoo). Note: If you have extended one of the provided interfaces in order to load/save data associated with an extra credit feature, be sure to also call setImplementation on the new interface. For example, if we provide an interface A, and you extend it with interface B and implement interface B with class C, your code should look like this:
parser.setImplementation(A.class, C.class); parser.setImplementation(B.class, C.class);
Scene scene = (Scene)parser.parse(file);Sometimes, the user will want to select multiple files to parse, because some of the files depend on objects defined in other files. In this case, call
List objects = parser.parse(files);and look through the objects List for a Scene object (use the instanceof operator: if (obj instanceof Scene) { ... }). It is important that you make this call and not multiple calls with single files, since otherwise the parser cannot resolve name references that go from one file to another.
Watch this location for additional test files to be posted.
cs418/*/*.java cs418/*/*.class cs418/Main.classThat is, a cs418 directory with subdirectories beneath it. Each java file must have a corresponding class file within the same directory. In addition, you must have a cs418.Main class. This is the class we will be calling in order to run your project. If you want, you can just have this class call your real main method somewhere else in your project (this is probably a good idea, since you will have different entry points into your project as the project evolves over the semester). You will create a submission.jar file as you did for the last project, by first changing into the directory above the cs418 subdirectory and executing
jar cvf submission.jar cs418You will then submit this file using the web interface. You may submit multiple times, but only the last submission counts. We will be using the following command to run and grade your project:
java -cp submission.jar;gl4java.jar;vecmath.jar;parser.jar cs418.MainTry running this at least a couple of hours before the submission deadline. If this does not start up your project, you will lose a significant number of points on your assignment. We will have gl4java.jar, vecmath.jar, and parser.jar, so there is no need to submit these. Also, the gl4java dll will be in our PATH.