modules/graphics/src/main/java/com/sun/prism/d3d/D3DMeshView.java

Print this page




  64     }
  65 
  66     @Override
  67     public void setMaterial(Material material) {
  68         context.setMaterial(nativeHandle,
  69                 ((D3DPhongMaterial) material).getNativeHandle());
  70         this.material = (D3DPhongMaterial) material;
  71     }
  72 
  73     @Override
  74     public void setWireframe(boolean wireframe) {
  75         context.setWireframe(nativeHandle, wireframe);
  76     }
  77 
  78     @Override
  79     public void setAmbientLight(float r, float g, float b) {
  80         context.setAmbientLight(nativeHandle, r, g, b);
  81     }
  82 
  83     @Override
  84     public void setPointLight(int index, float x, float y, float z, float r, float g, float b, float w) {

  85         // NOTE: We only support up to 3 point lights at the present
  86         if (index >= 0 && index <= 2) {



  87             context.setPointLight(nativeHandle, index, x, y, z, r, g, b, w);
  88         }
  89     }
  90 
  91     @Override
  92     public void render(Graphics g) {
  93         material.lockTextureMaps();
  94         context.renderMeshView(nativeHandle, g.getTransformNoClone());
  95         material.unlockTextureMaps();
  96     }
  97 
  98     @Override
  99     public void dispose() {
 100         // TODO: 3D - Need a mechanism to "decRefCount" Mesh and Material
 101         material = null;
 102         disposerRecord.dispose();
 103         count--;
 104     }
 105 
 106     public int getCount() {
 107         return count;
 108     }
 109 
 110     static class D3DMeshViewDisposerRecord implements Disposer.Record {
 111 
 112         private final D3DContext context;
 113         private long nativeHandle;
 114 


  64     }
  65 
  66     @Override
  67     public void setMaterial(Material material) {
  68         context.setMaterial(nativeHandle,
  69                 ((D3DPhongMaterial) material).getNativeHandle());
  70         this.material = (D3DPhongMaterial) material;
  71     }
  72 
  73     @Override
  74     public void setWireframe(boolean wireframe) {
  75         context.setWireframe(nativeHandle, wireframe);
  76     }
  77 
  78     @Override
  79     public void setAmbientLight(float r, float g, float b) {
  80         context.setAmbientLight(nativeHandle, r, g, b);
  81     }
  82 
  83     @Override
  84     public void setPointLight(int index, float pixelScaleFactor,
  85             float x, float y, float z, float r, float g, float b, float w) {
  86         // NOTE: We only support up to 3 point lights at the present
  87         if (index >= 0 && index <= 2) {
  88             x *= pixelScaleFactor;
  89             y *= pixelScaleFactor;
  90             z *= pixelScaleFactor;
  91             context.setPointLight(nativeHandle, index, x, y, z, r, g, b, w);
  92         }
  93     }
  94 
  95     @Override
  96     public void render(Graphics g) {
  97         material.lockTextureMaps();
  98         context.renderMeshView(nativeHandle, g);
  99         material.unlockTextureMaps();
 100     }
 101 
 102     @Override
 103     public void dispose() {
 104         // TODO: 3D - Need a mechanism to "decRefCount" Mesh and Material
 105         material = null;
 106         disposerRecord.dispose();
 107         count--;
 108     }
 109 
 110     public int getCount() {
 111         return count;
 112     }
 113 
 114     static class D3DMeshViewDisposerRecord implements Disposer.Record {
 115 
 116         private final D3DContext context;
 117         private long nativeHandle;
 118