tuxmartin

PGRF2 - cviceni 1

Feb 14th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.awt.image.BufferedImage;
  2. import java.util.List;
  3.  
  4. import transforms3Dplus.Mat4;
  5. import transforms3Dplus.Mat4Identity;
  6. import transforms3Dplus.Point3D;
  7.  
  8.  
  9. public class GPU {
  10.     BufferedImage img;
  11.     List<Integer> ib;
  12.     List<Point3D> vb;
  13.     Mat4 Model, View, Proj;
  14.    
  15.     public GPU(BufferedImage img) {
  16.         this.img = img;
  17.         init();
  18.     }
  19.    
  20.     public void init() {
  21.         Model = new Mat4Identity();
  22.         View  = new Mat4Identity();
  23.         Proj  = new Mat4Identity();    
  24.     }
  25.    
  26.     public void Render(List<Integer> ib, List<Point3D> vb) {
  27.         this.ib = ib;
  28.         this.vb = vb;
  29.        
  30.         redraw();
  31.     }
  32.    
  33.     public void redraw() {
  34.         for (int i = 0; i < ib.size(); i+=3) {
  35.             drawTriangle(vb.get(ib.get(i)), vb.get(ib.get(i+1)), vb.get(ib.get(i+2)));         
  36.         }
  37.        
  38.     }
  39.    
  40.     public void drawTriangle(Point3D a, Point3D b, Point3D c) {
  41.        
  42.     }
  43.    
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment