当前位置: 首页>>代码示例>>Java>>正文


Java PhongMaterial.setDiffuseMap方法代码示例

本文整理汇总了Java中javafx.scene.paint.PhongMaterial.setDiffuseMap方法的典型用法代码示例。如果您正苦于以下问题:Java PhongMaterial.setDiffuseMap方法的具体用法?Java PhongMaterial.setDiffuseMap怎么用?Java PhongMaterial.setDiffuseMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.paint.PhongMaterial的用法示例。


在下文中一共展示了PhongMaterial.setDiffuseMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildScene

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
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);
	}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:40,代码来源:MarsViewer.java

示例2: getMaterialWithColor

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
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;
    }
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:15,代码来源:TriangleMeshHelper.java

示例3: clearMaterialAndSetDiffMap

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
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);        
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:11,代码来源:TriangleMeshHelper.java

示例4: clearMaterialAndSetColor

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
private void clearMaterialAndSetColor(PhongMaterial mat, Color col){
    mat.setBumpMap(null);
    mat.setSpecularMap(null);
    mat.setSelfIlluminationMap(null);
    mat.setDiffuseMap(null);
    
    mat.setDiffuseColor(col);
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:9,代码来源:TriangleMeshHelper.java

示例5: setMaterial

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
public static void setMaterial(final Planetoid _planetoid, final String _phongFile) {
	final PhongMaterial material = new PhongMaterial();
	
	String diffFile = "", normFile = "", specFile = "";
	try {
		URL url = MediaHelper.getURLForMedia(_phongFile);

		JSONParser parser = new JSONParser();

		MediaHelper.addToSearchPath(url.getPath().substring(0, url.getPath().lastIndexOf('/')));

		Object obj = parser.parse(MediaHelper.getContentAsString(url));
		if(obj == null)
			return;

		JSONObject jsonObject = (JSONObject) obj;

		if((diffFile = (String) jsonObject.get("diffuse")) != null)
			material.setDiffuseMap(new Image(MediaHelper.getURLForFile(diffFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true));
		if((normFile = (String) jsonObject.get("normal")) != null)
			material.setBumpMap(new Image(MediaHelper.getURLForFile(normFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true));
		if((specFile = (String) jsonObject.get("specular")) != null)
			material.setSpecularMap(new Image(MediaHelper.getURLForFile(specFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true));
	} catch(ParseException e) { e.printStackTrace(); }

	_planetoid.setMaterial(material);
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:28,代码来源:PlanetoidEnlightment.java

示例6: setTexture

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
public static void setTexture(final Planetoid _planetoid, final String _textureFile) {
		final Image         texture  = new Image(MediaHelper.getURLForFile(_textureFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true);
		final PhongMaterial material = new PhongMaterial();

		material.setDiffuseMap(texture);
//		material.setBumpMap(texture);
//		material.setSpecularMap(texture);
//		material.setSelfIlluminationMap(texture);
//		material.setDiffuseColor(Color.WHITE);
		material.setSpecularColor(Color.WHITE);

		_planetoid.setMaterial(material);
	}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:14,代码来源:PlanetoidEnlightment.java

示例7: getMaterialWithPattern

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
public Material getMaterialWithPattern(){
    PhongMaterial mat = new PhongMaterial();
    mat.setDiffuseMap(getPatternImage());
    mat.setSpecularPower(32);
    mat.setDiffuseColor(Color.WHITE);
    mat.setSpecularColor(Color.WHITE);
    return mat;
}
 
开发者ID:FXyz,项目名称:FXyzLib,代码行数:9,代码来源:TriangleMeshHelper.java

示例8: getMaterialWithPalette

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
public Material getMaterialWithPalette(){
    PhongMaterial mat = new PhongMaterial();
    mat.setDiffuseMap(getPaletteImage());
    mat.setSpecularPower(20);
    mat.setDiffuseColor(Color.WHITE);
    mat.setSpecularColor(Color.WHITE);
    return mat;
}
 
开发者ID:FXyz,项目名称:FXyzLib,代码行数:9,代码来源:TriangleMeshHelper.java

示例9: clearMaterialAndSetDiffMap

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
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);
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:11,代码来源:TriangleMeshHelper.java

示例10: clearMaterialAndSetColor

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
private void clearMaterialAndSetColor(PhongMaterial mat, Color col){
    mat.setBumpMap(null);
    mat.setSpecularMap(null);
    mat.setSelfIlluminationMap(null);
    mat.setDiffuseMap(null);

    mat.setDiffuseColor(col);
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:9,代码来源:TriangleMeshHelper.java

示例11: addTiles

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
public void addTiles() {
    for (Tile tile : Board.getTiles()) {
        MeshView mesh = tile.getMesh();
        PhongMaterial material = new PhongMaterial(Color.WHITE);
        material.setDiffuseMap(new Image(GameGroup.class.getResourceAsStream(tile.getResourceString())));
        mesh.setMaterial(material);
        mesh.getTransforms().add(new Translate(tile.getCenter().getX(), tile.getCenter().getY(), tile.getCenter().getZ()));
        getChildren().add(mesh);
    }
}
 
开发者ID:Spanner41,项目名称:SettlersJava,代码行数:11,代码来源:GameGroup.java

示例12: createMaterial

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
protected Material createMaterial() {
	PhongMaterial material = new PhongMaterial();
	material.setDiffuseMap(skin);
	return material;
}
 
开发者ID:InfinityStudio,项目名称:minecraft-jfx-skin,代码行数:6,代码来源:SkinCanvas.java

示例13: RectangleMesh

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
/**
 * Constructs a rectangle Mesh which is an
 * extended class of meshView : a 3d object
 * @since v0.2
 *
 * @param width defines the width of the mesh
 * @param height defines the height of the mesh
 * @param depth defines the depth of the mesh
 * @param texturePath defines the path of the mesh texture
 * @param textureFaceWidth defines the number of width pixels of the card front on the texture
 * @param textureFaceHeight defines the number of height pixels of the card front on the texture
 */
RectangleMesh(float width, float height, float depth,
              String texturePath, float textureFaceWidth, float textureFaceHeight)
{
    super();
    float textureWidth;
    float textureHeight;
    javafx.scene.image.Image image;
    image = new javafx.scene.image.Image(texturePath);
    textureHeight = (float)image.getHeight();
    textureWidth = (float)image.getWidth();
    float textureDepth = (textureHeight - textureFaceHeight)/2;


    TriangleMesh mesh = new TriangleMesh();
    mesh.getPoints().addAll(
            0, 0, 0,        //P0
            width, 0, 0,      //P1
            0, height, 0,      //P2
            width, height, 0,     //P3
            0, 0, depth,      //P4
            width, 0, depth,    //P5
            0, height, depth,    //P6
            width, height, depth //P7
    );

    mesh.getTexCoords().addAll(
            (textureDepth/textureWidth), 0,       //T0
            ((textureDepth+textureFaceWidth)/textureWidth), 0,        //T1
            0, (textureDepth/textureWidth),       //T2
            (textureDepth/textureWidth), (textureDepth/textureHeight),   //T3
            ((textureDepth+textureFaceWidth)/textureWidth), (textureDepth/textureHeight),    //T4
            ((2*textureDepth+textureFaceWidth)/textureWidth), (textureDepth/textureHeight),   //T5
            1, (textureDepth/textureHeight),       //T6
            0, ((textureDepth+textureFaceHeight)/textureHeight),        //T7
            (textureDepth/textureWidth), ((textureDepth+textureFaceHeight)/textureHeight),    //T8
            ((textureDepth+textureFaceWidth)/textureWidth), ((textureDepth+textureFaceHeight)/textureHeight),     //T9
            ((2*textureDepth+textureFaceWidth)/textureWidth), ((textureDepth+textureFaceHeight)/textureHeight),    //T10
            1, ((textureDepth+textureFaceHeight)/textureHeight),        //T11
            (textureDepth/textureWidth), 1,   //T12
            ((textureDepth+textureFaceWidth)/textureWidth), 1     //T13
    );

    mesh.getFaces().addAll(
            5,1,4,0,0,3     //P5,T1 ,P4,T0  ,P0,T3
            ,5,1,0,3,1,4    //P5,T1 ,P0,T3  ,P1,T4
            ,0,3,4,2,6,7    //P0,T3 ,P4,T2  ,P6,T7
            ,0,3,6,7,2,8    //P0,T3 ,P6,T7  ,P2,T8
            ,1,4,0,3,2,8    //P1,T4 ,P0,T3  ,P2,T8
            ,1,4,2,8,3,9    //P1,T4 ,P2,T8  ,P3,T9
            ,5,5,1,4,3,9    //P5,T5 ,P1,T4  ,P3,T9
            ,5,5,3,9,7,10   //P5,T5 ,P3,T9  ,P7,T10
            ,4,6,5,5,7,10   //P4,T6 ,P5,T5  ,P7,T10
            ,4,6,7,10,6,11  //P4,T6 ,P7,T10 ,P6,T11
            ,3,9,2,8,6,12   //P3,T9 ,P2,T8  ,P6,T12
            ,3,9,6,12,7,13  //P3,T9 ,P6,T12 ,P7,T13
    );
    this.setMesh(mesh);

    PhongMaterial material = new PhongMaterial();
    material.setDiffuseMap(image);
    this.setMaterial(material);
    transformations = new Transformations(this);
}
 
开发者ID:Bokoblin,项目名称:DUTS3-CPOA-ProjetTarot,代码行数:76,代码来源:RectangleMesh.java

示例14: fromImage

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
public static Material fromImage( String fileName ) {
	Image img = new Image("file:"+fileName);
	PhongMaterial mat = new PhongMaterial();
	mat.setDiffuseMap(img);
	return mat;		
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:7,代码来源:PhongPhactory.java

示例15: getMaterialWithImage

import javafx.scene.paint.PhongMaterial; //导入方法依赖的package包/类
public Material getMaterialWithImage(String image){
    PhongMaterial mat = new PhongMaterial();
    mat.setDiffuseMap(new Image(image));
    return mat;
}
 
开发者ID:FXyz,项目名称:FXyzLib,代码行数:6,代码来源:TriangleMeshHelper.java


注:本文中的javafx.scene.paint.PhongMaterial.setDiffuseMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。