Java Code Examples for javafx.scene.paint.PhongMaterial#setBumpMap()

The following examples show how to use javafx.scene.paint.PhongMaterial#setBumpMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarsViewer.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private Group buildScene() {
	    Sphere mars = new Sphere(MARS_RADIUS);
	    mars.setTranslateX(VIEWPORT_SIZE / 2d);
	    mars.setTranslateY(VIEWPORT_SIZE / 2d);

	    PhongMaterial material = new PhongMaterial();
	    material.setDiffuseMap(
	      new Image(this.getClass().getResource(DIFFUSE_MAP).toExternalForm(),
	        MAP_WIDTH,
	        MAP_HEIGHT,
	        true,
	        true
	      )
	    );

	    material.setBumpMap(
	      new Image(this.getClass().getResource(NORMAL_MAP).toExternalForm(),
	        MAP_WIDTH,
	        MAP_HEIGHT,
	        true,
	        true
	      )
	    );
/*
	    material.setSpecularMap(
	      new Image(this.getClass().getResource(SPECULAR_MAP).toExternalForm(),
	        MAP_WIDTH,
	        MAP_HEIGHT,
	        true,
	        true
	      )
	    );
*/
	    mars.setMaterial(
	        material
	    );

	    return new Group(mars);
	}
 
Example 2
Source File: TriangleMeshHelper.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
public Material getMaterialWithColor(Color color, String image){
        PhongMaterial mat = new PhongMaterial(color);
        if(image!=null && !image.isEmpty()){
            Image img = new Image(image);
            mat.setDiffuseMap(img);
            NormalMap normal = new NormalMap(img);
//            normal.setIntensity(10);
//            normal.setIntensityScale(2);
            mat.setBumpMap(normal);
        }
        mat.setSpecularPower(32);
        mat.setSpecularColor(Color.WHITE);
        return mat;
    }
 
Example 3
Source File: TriangleMeshHelper.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
private void clearMaterialAndSetDiffMap(PhongMaterial mat, Image diff){
    mat.setBumpMap(null);
    mat.setSpecularMap(null);
    mat.setSelfIlluminationMap(null);
    
    mat.setDiffuseColor(DEFAULT_DIFFUSE_COLOR);
    mat.setSpecularColor(DEFAULT_SPECULAR_COLOR);
    
    mat.setDiffuseMap(diff);        
}
 
Example 4
Source File: TriangleMeshHelper.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
private void clearMaterialAndSetColor(PhongMaterial mat, Color col){
    mat.setBumpMap(null);
    mat.setSpecularMap(null);
    mat.setSelfIlluminationMap(null);
    mat.setDiffuseMap(null);
    
    mat.setDiffuseColor(col);
}