84 public void setAmbientLight(float r, float g, float b) { 85 ambientLightRed = r; 86 ambientLightGreen = g; 87 ambientLightBlue = b; 88 context.setAmbientLight(nativeHandle, r, g, b); 89 } 90 91 float getAmbientLightRed() { 92 return ambientLightRed; 93 } 94 95 float getAmbientLightGreen() { 96 return ambientLightGreen; 97 } 98 99 float getAmbientLightBlue() { 100 return ambientLightBlue; 101 } 102 103 @Override 104 public void setPointLight(int index, float x, float y, float z, float r, float g, float b, float w) { 105 // NOTE: We only support up to 3 point lights at the present 106 if (index >= 0 && index <= 2) { 107 lights[index] = new ES2Light(x, y, z, r, g, b, w); 108 context.setPointLight(nativeHandle, index, x, y, z, r, g, b, w); 109 } 110 } 111 112 ES2Light[] getPointLights() { 113 return lights; 114 } 115 116 @Override 117 public void render(Graphics g) { 118 material.lockTextureMaps(); 119 context.renderMeshView(nativeHandle, g.getTransformNoClone(), this); 120 material.unlockTextureMaps(); 121 } 122 123 ES2PhongMaterial getMaterial() { 124 return material; 125 } 126 127 @Override 128 public void dispose() { 129 // TODO: 3D - Need a mechanism to "decRefCount" Mesh and Material 130 material = null; 131 lights = null; 132 disposerRecord.dispose(); 133 count--; 134 } 135 136 public int getCount() { 137 return count; 138 } 139 | 84 public void setAmbientLight(float r, float g, float b) { 85 ambientLightRed = r; 86 ambientLightGreen = g; 87 ambientLightBlue = b; 88 context.setAmbientLight(nativeHandle, r, g, b); 89 } 90 91 float getAmbientLightRed() { 92 return ambientLightRed; 93 } 94 95 float getAmbientLightGreen() { 96 return ambientLightGreen; 97 } 98 99 float getAmbientLightBlue() { 100 return ambientLightBlue; 101 } 102 103 @Override 104 public void setPointLight(int index, float pixelScaleFactor, 105 float x, float y, float z, float r, float g, float b, float w) { 106 // NOTE: We only support up to 3 point lights at the present 107 if (index >= 0 && index <= 2) { 108 x *= pixelScaleFactor; 109 y *= pixelScaleFactor; 110 z *= pixelScaleFactor; 111 lights[index] = new ES2Light(x, y, z, r, g, b, w); 112 context.setPointLight(nativeHandle, index, x, y, z, r, g, b, w); 113 } 114 } 115 116 ES2Light[] getPointLights() { 117 return lights; 118 } 119 120 @Override 121 public void render(Graphics g) { 122 material.lockTextureMaps(); 123 context.renderMeshView(nativeHandle, g, this); 124 material.unlockTextureMaps(); 125 } 126 127 ES2PhongMaterial getMaterial() { 128 return material; 129 } 130 131 @Override 132 public void dispose() { 133 // TODO: 3D - Need a mechanism to "decRefCount" Mesh and Material 134 material = null; 135 lights = null; 136 disposerRecord.dispose(); 137 count--; 138 } 139 140 public int getCount() { 141 return count; 142 } 143 |