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


Java DistanceLodCalculator类代码示例

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


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

示例1: read

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的package包/类
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    size = ic.readInt("size", 16);
    totalSize = ic.readInt("totalSize", 16);
    quadrant = ic.readShort("quadrant", (short)0);
    stepScale = (Vector3f) ic.readSavable("stepScale", Vector3f.UNIT_XYZ);
    offset = (Vector2f) ic.readSavable("offset", Vector3f.UNIT_XYZ);
    offsetAmount = ic.readFloat("offsetAmount", 0);
    lodCalculator = (LodCalculator) ic.readSavable("lodCalculator", new DistanceLodCalculator());
    lodCalculator.setTerrainPatch(this);
    lodCalculatorFactory = (LodCalculatorFactory) ic.readSavable("lodCalculatorFactory", null);
    lodEntropy = ic.readFloatArray("lodEntropy", null);
    geomap = (LODGeomap) ic.readSavable("geomap", null);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:TerrainPatch.java

示例2: createSheet

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("DistanceLodControl");
    DistanceLodCalculator obj = lodCalculator;
    if (obj == null) {
        return sheet;
    }

    set.put(makeProperty(obj, float.class, "getLodMultiplier", "setLodMultiplier", "Multiplier"));
    
    sheet.put(set);
    return sheet;

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

示例3: createNodes

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的package包/类
@Override
protected Node[] createNodes(Object key) {
    if (key instanceof DistanceLodCalculator) {
        DistanceLodCalculator assetKey = (DistanceLodCalculator) key;
        return new Node[]{new JmeDistanceLodCalculator(control, assetKey, getDataObject())};
    } else if (key instanceof PerspectiveLodCalculator) {
        //PerspectiveLodCalculator assetKey = (PerspectiveLodCalculator) key;
        //return new Node[]{new JmePerspectiveLodCalculator(control, assetKey)};
    }
    return null;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:12,代码来源:JmeTerrainLodControl.java

示例4: JmeDistanceLodCalculator

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的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

示例5: TerrainLodControl

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的package包/类
public TerrainLodControl(Terrain terrain, Camera camera) {
    List<Camera> cams = new ArrayList<Camera>();
    cams.add(camera);
    this.terrain = terrain;
    this.cameras = cams;
    lodCalculator = new DistanceLodCalculator(65, 2.7f); // a default calculator
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:8,代码来源:TerrainLodControl.java

示例6: read

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的package包/类
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    terrain = (Terrain) ic.readSavable("terrain", null);
    lodCalculator = (LodCalculator) ic.readSavable("lodCalculator", new DistanceLodCalculator());
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:8,代码来源:TerrainLodControl.java

示例7: getExplorerObjectClass

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

示例8: TiledTerrain

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的package包/类
TiledTerrain() {
    // TERRAIN TEXTURE material
    matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
    matTerrain.setBoolean("useTriPlanarMapping", false);
    matTerrain.setBoolean("WardIso", true);
    matTerrain.setFloat("Shininess", 0);

    // 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);

    // CREATE THE TERRAIN
    terrain1 = new TerrainQuad("terrain 1", 65, 513, null);
    terrain1.setMaterial(matTerrain);
    terrain1.setLocalTranslation(-256, -100, -256);
    terrain1.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain1);

    terrain2 = new TerrainQuad("terrain 2", 65, 513, null);
    terrain2.setMaterial(matTerrain);
    terrain2.setLocalTranslation(-256, -100, 256);
    terrain2.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain2);

    terrain3 = new TerrainQuad("terrain 3", 65, 513, null);
    terrain3.setMaterial(matTerrain);
    terrain3.setLocalTranslation(256, -100, -256);
    terrain3.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain3);

    terrain4 = new TerrainQuad("terrain 4", 65, 513, null);
    terrain4.setMaterial(matTerrain);
    terrain4.setLocalTranslation(256, -100, 256);
    terrain4.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain4);
    
    terrain1.setNeighbourFinder(this);
    terrain2.setNeighbourFinder(this);
    terrain3.setNeighbourFinder(this);
    terrain4.setNeighbourFinder(this);
    
    MultiTerrainLodControl lodControl = new MultiTerrainLodControl(getCamera());
    lodControl.setLodCalculator( new DistanceLodCalculator(65, 2.7f) ); // patch size, and a multiplier
    lodControl.addTerrain(terrain1);
    lodControl.addTerrain(terrain2);
    lodControl.addTerrain(terrain3);// order of these seems to matter
    lodControl.addTerrain(terrain4);
    this.addControl(lodControl);
    
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:53,代码来源:TerrainTestTile.java

示例9: MultiTerrainLodControl

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的package包/类
public MultiTerrainLodControl(List<Camera> cameras) {
    this.cameras = cameras;
    lodCalculator = new DistanceLodCalculator(65, 2.7f);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:5,代码来源:MultiTerrainLodControl.java

示例10: doCreateTerrain

import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator; //导入依赖的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


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