• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TerrainLodControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jme3.terrain.geomipmap.TerrainLodControl的典型用法代码示例。如果您正苦于以下问题:Java TerrainLodControl类的具体用法?Java TerrainLodControl怎么用?Java TerrainLodControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TerrainLodControl类属于com.jme3.terrain.geomipmap包,在下文中一共展示了TerrainLodControl类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createSheet

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
    Sheet sheet = super.createSheet();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("TerrainLodControl");
    set.setName(TerrainLodControl.class.getName());
    TerrainLodControl obj = terrainLodControl;
    if (obj == null) {
        return sheet;
    }
    
    set.put(makeProperty(obj, boolean.class, "isEnabled", "setEnabled", "Enabled"));

    sheet.put(set);
    return sheet;

}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:18,代码来源:JmeTerrainLodControl.java


示例2: loadTerrain

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
public void loadTerrain(TerrainDefinition terrainDefinition) {
    Texture grass = assetManager.loadTexture(terrainDefinition.tx1().path());
    grass.setWrap(Texture.WrapMode.Repeat);

    Texture water = assetManager.loadTexture(terrainDefinition.tx2().path());
    water.setWrap(Texture.WrapMode.Repeat);

    Texture land = assetManager.loadTexture(terrainDefinition.tx3().path());
    land.setWrap(Texture.WrapMode.Repeat);
    float scale = 100;
    Material mat_terrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
    mat_terrain.setTexture("AlphaMap", assetManager.loadTexture("Maps/Adria/AdriaSmall_alpha.png"));
    mat_terrain.setTexture("DiffuseMap", texture(terrainDefinition.tx1().path()));
    mat_terrain.setFloat("DiffuseMap_0_scale", terrainDefinition.tx1().scale());  //playing with scales
    mat_terrain.setTexture("DiffuseMap_2", texture(terrainDefinition.tx2().path()));
    mat_terrain.setFloat("DiffuseMap_2_scale", terrainDefinition.tx2().scale());
    mat_terrain.setTexture("DiffuseMap_1", texture(terrainDefinition.tx3().path()));
    mat_terrain.setFloat("DiffuseMap_1_scale", terrainDefinition.tx3().scale());
    

    int patchSize = 17;
    terrain = terrainDefinition.heightMapPath().map(m -> assetManager.loadTexture(m)
            .getImage()).map(i -> new ImageBasedHeightMap(i, 10f))
            .map(hm -> {
                hm.load();
                return new TerrainQuad("Terrain", patchSize, hm.getSize()+1, hm.getHeightMap());
            }).map(tq -> {
                tq.setMaterial(mat_terrain);
                tq.setLocalScale(scale, 1f, scale); // 1pixel 1m * scale * m
                tq.addControl(new TerrainLodControl(tq, camera.testCamera()));
                tq.setShadowMode(RenderQueue.ShadowMode.Receive);
                setLocation(tq,99,512,2048,scale);
                rootNode.attachChild(tq);
                return tq;
            });
}
 
开发者ID:ZoltanTheHun,项目名称:SkyHussars,代码行数:37,代码来源:TerrainManager.java


示例3: enableLodControl

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
/**
 * Re-attach the camera to the LOD control.
 * Called when the scene is opened and will only
 * update the control if there is already a terrain present in
 * the scene.
 */
public static void enableLodControl(Camera camera, Node rootNode) {
    
    Terrain terrain = (Terrain) findTerrain(rootNode);
    if (terrain == null)
        return;
    
    TerrainLodControl control = ((Spatial)terrain).getControl(TerrainLodControl.class);
    if (control != null) {
        control.setCamera(camera);
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:18,代码来源:TerrainUtils.java


示例4: JmeTerrainLodControl

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
public JmeTerrainLodControl(TerrainLodControl control, Children children) {
    super(children);
    getLookupContents().add(control);
    getLookupContents().add(this);
    this.terrainLodControl = control;
    this.control = control;
    setName("TerrainLodControl");
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:9,代码来源:JmeTerrainLodControl.java


示例5: createNodes

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
@Override
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
    TerrainLodControlChildren children = new TerrainLodControlChildren((TerrainLodControl) key);
    children.setReadOnly(cookie);
    children.setDataObject(key2);
    return new org.openide.nodes.Node[]{new JmeTerrainLodControl((TerrainLodControl) key, children).setReadOnly(cookie)};
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:8,代码来源:JmeTerrainLodControl.java


示例6: JmeDistanceLodCalculator

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
public JmeDistanceLodCalculator(TerrainLodControl lodControl, DistanceLodCalculator lodCalculator, DataObject dataObject) {
    super(Children.LEAF);
    this.lodControl=lodControl;
    this.lodCalculator = lodCalculator;
    this.dataObject = dataObject;
    getLookupContents().add(lodCalculator);
    getLookupContents().add(this);
    setName("DistanceLodCalculator");
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:10,代码来源:JmeDistanceLodCalculator.java


示例7: JmeTerrainLodControl

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
public JmeTerrainLodControl(TerrainLodControl control, Children children) {
    super(children);
    getLookupContents().add(control);
    getLookupContents().add(this);
    this.terrainLodControl = control;
    setName("TerrainLodControl");
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:8,代码来源:JmeTerrainLodControl.java


示例8: simpleInitApp

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    loadHintText();
    initCrossHairs();
    setupKeys();

    // First, we load up our textures and the heightmap texture for the terrain

    // TERRAIN TEXTURE material
    matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
    matTerrain.setBoolean("useTriPlanarMapping", false);
    matTerrain.setBoolean("WardIso", true);

    // ALPHA map (for splat textures)
    matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));

    // GRASS texture
    Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    grass.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("DiffuseMap", grass);
    matTerrain.setFloat("DiffuseMap_0_scale", grassScale);

    // DIRT texture
    Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
    dirt.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("DiffuseMap_1", dirt);
    matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);

    // ROCK texture
    Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
    rock.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("DiffuseMap_2", rock);
    matTerrain.setFloat("DiffuseMap_2_scale", rockScale);

    // WIREFRAME material
    matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    matWire.getAdditionalRenderState().setWireframe(true);
    matWire.setColor("Color", ColorRGBA.Green);

    // CREATE THE TERRAIN
    terrain = new TerrainQuad("terrain", 65, 513, null);
    List<Camera> cameras = new ArrayList<Camera>();
    cameras.add(getCamera());
    TerrainLodControl control = new TerrainLodControl(terrain, cameras);
    terrain.addControl(control);
    terrain.setMaterial(matTerrain);
    terrain.setLocalTranslation(0, -100, 0);
    terrain.setLocalScale(2f, 1f, 2f);
    rootNode.attachChild(terrain);

    DirectionalLight light = new DirectionalLight();
    light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
    rootNode.addLight(light);

    AmbientLight ambLight = new AmbientLight();
    ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
    rootNode.addLight(ambLight);

    cam.setLocation(new Vector3f(0, 10, -10));
    cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:62,代码来源:TerrainTestModifyHeight.java


示例9: getExplorerObjectClass

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
@Override
public Class getExplorerObjectClass() {
    return TerrainLodControl.class;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:5,代码来源:JmeTerrainLodControl.java


示例10: TerrainLodControlChildren

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
public TerrainLodControlChildren(TerrainLodControl control) {
    this.control = control;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:4,代码来源:JmeTerrainLodControl.java


示例11: doCreateTerrain

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
protected Spatial doCreateTerrain(Node parent,
                                   int totalSize,
                                   int patchSize,
                                   int alphaTextureSize,
                                   float[] heightmapData,
                                   String sceneName,
                                   org.openide.nodes.Node selectedNode) throws IOException
   {
       final ProjectAssetManager manager = selectedNode.getLookup().lookup(ProjectAssetManager.class);
       
       Terrain terrain = new TerrainQuad("terrain-"+sceneName, patchSize, totalSize, heightmapData); //TODO make this pluggable for different Terrain implementations
       com.jme3.material.Material mat = new com.jme3.material.Material(manager, "Common/MatDefs/Terrain/TerrainLighting.j3md");

       String assetFolder = "";
       if (manager != null && manager instanceof ProjectAssetManager)
           assetFolder = ((ProjectAssetManager)manager).getAssetFolderName();

       // write out 3 alpha blend images
       for (int i=0; i<TerrainEditorController.NUM_ALPHA_TEXTURES; i++) {
           BufferedImage alphaBlend = new BufferedImage(alphaTextureSize, alphaTextureSize, BufferedImage.TYPE_INT_ARGB);
           if (i == 0) {
               // the first alpha level should be opaque so we see the first texture over the whole terrain
               for (int h=0; h<alphaTextureSize; h++)
                   for (int w=0; w<alphaTextureSize; w++)
                       alphaBlend.setRGB(w, h, 0x00FF0000);//argb
           }
           File alphaFolder = new File(assetFolder+"/Textures/terrain-alpha/");
           if (!alphaFolder.exists())
               alphaFolder.mkdir();
           String alphaBlendFileName = "/Textures/terrain-alpha/"+sceneName+"-"+((Node)terrain).getName()+"-alphablend"+i+".png";
           File alphaImageFile = new File(assetFolder+alphaBlendFileName);
           ImageIO.write(alphaBlend, "png", alphaImageFile);
           Texture tex = manager.loadAsset(new TextureKey(alphaBlendFileName, false));
           if (i == 0)
               mat.setTexture("AlphaMap", tex);
           else if (i == 1)
               mat.setTexture("AlphaMap_1", tex);
           else if (i == 2)
               mat.setTexture("AlphaMap_2", tex);
       }
       
       Texture defaultTexture = manager.loadTexture(TerrainEditorController.DEFAULT_TERRAIN_TEXTURE);
       
       // copy the default texture to the assets folder if it doesn't exist there yet
       String dirtTextureName = "/Textures/dirt.jpg";
       File dirtTextureFile = new File(assetFolder+dirtTextureName);
       if (!dirtTextureFile.exists()) {
           BufferedImage bi = ImageToAwt.convert(defaultTexture.getImage(), false, true, 0);
           ImageIO.write(bi, "jpg", dirtTextureFile);
       }
       // give the first layer default texture
       Texture dirtTexture = manager.loadTexture(dirtTextureName);
       dirtTexture.setWrap(WrapMode.Repeat);
       mat.setTexture("DiffuseMap", dirtTexture);
       mat.setFloat("DiffuseMap_0_scale", TerrainEditorController.DEFAULT_TEXTURE_SCALE);
       mat.setBoolean("WardIso", true);

       ((Node)terrain).setMaterial(mat);
       ((Node)terrain).setModelBound(new BoundingBox());
       ((Node)terrain).updateModelBound();
       ((Node)terrain).setLocalTranslation(0, 0, 0);
       ((Node)terrain).setLocalScale(1f, 1f, 1f);

       // add the lod control
       TerrainLodControl control = new TerrainLodControl(terrain, SceneApplication.getApplication().getCamera());
       control.setLodCalculator(new DistanceLodCalculator(patchSize, 2.7f));
((Node)terrain).addControl(control);

       parent.attachChild((Node)terrain);

       //setNeedsSave(true);
       //addSpatialUndo(parent, (Node)terrain, jmeNodeParent);
       
       return (Spatial)terrain;
   }
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:76,代码来源:AddTerrainAction.java


示例12: getExplorerObjectClass

import com.jme3.terrain.geomipmap.TerrainLodControl; //导入依赖的package包/类
public Class getExplorerObjectClass() {
    return TerrainLodControl.class;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:4,代码来源:JmeTerrainLodControl.java



注:本文中的com.jme3.terrain.geomipmap.TerrainLodControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RxHelper类代码示例发布时间:2022-05-22
下一篇:
Java PlatformEventNotifier类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap