本文整理汇总了Java中com.jme3.terrain.geomipmap.TerrainQuad类的典型用法代码示例。如果您正苦于以下问题:Java TerrainQuad类的具体用法?Java TerrainQuad怎么用?Java TerrainQuad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TerrainQuad类属于com.jme3.terrain.geomipmap包,在下文中一共展示了TerrainQuad类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changePaintControlShininess
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
/**
* Change the shininess value.
*/
@FromAnyThread
private void changePaintControlShininess(@NotNull final Float newValue) {
if (isIgnoreListeners()) return;
final TerrainQuad processedObject = getProcessedObject();
final Material mat = processedObject.getMaterial();
final MatParam param = mat.getParam("Shininess");
final float shininess = param == null ? 0F : (float) param.getValue();
final PropertyOperation<ChangeConsumer, TerrainQuad, Float> operation =
new PropertyOperation<>(processedObject, TERRAIN_PARAM, newValue, shininess);
operation.setApplyHandler((terrainQuad, value) -> {
NodeUtils.visitGeometry(terrainQuad, geometry -> {
final Material material = geometry.getMaterial();
material.setFloat("Shininess", value);
});
});
final ModelChangeConsumer changeConsumer = getChangeConsumer();
changeConsumer.execute(operation);
}
示例2: changePaintControlTriPlanar
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
/**
* Change using tri-planar textures.
*/
@FromAnyThread
private void changePaintControlTriPlanar(@NotNull final Boolean newValue) {
if (isIgnoreListeners()) return;
final TerrainQuad processedObject = getProcessedObject();
final PropertyOperation<ChangeConsumer, TerrainQuad, Boolean> operation =
new PropertyOperation<>(processedObject, TERRAIN_PARAM, newValue, !newValue);
operation.setApplyHandler((terrainQuad, value) -> {
NodeUtils.visitGeometry(terrainQuad, geometry -> {
final Material material = geometry.getMaterial();
material.setBoolean("useTriPlanarMapping", value);
});
});
final ModelChangeConsumer changeConsumer = getChangeConsumer();
changeConsumer.execute(operation);
}
示例3: createSheet
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
Sheet.Set set = Sheet.createPropertiesSet();
set.setDisplayName("TerrainQuad");
set.setName(TerrainQuad.class.getName());
TerrainQuad obj = geom;//getLookup().lookup(Spatial.class);
if (obj == null) {
return sheet;
}
set.put(makeProperty(obj, int.class, "getMaxLod", "Max Lod"));
set.put(makeProperty(obj, short.class, "getQuadrant", "setQuadrant", "Quadrant"));
sheet.put(set);
return sheet;
}
示例4: installGameComponent
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
@Override
public void installGameComponent(Spatial parent) {
if (parent instanceof Terrain || parent instanceof TerrainQuad) {
Vector3f backupTrans = parent.getLocalTranslation().clone();
Quaternion backupRotation = parent.getLocalRotation().clone();
parent.setLocalTranslation(Vector3f.ZERO);
parent.setLocalRotation(Quaternion.IDENTITY);
CollisionShape terrainShape = CollisionShapeFactory.createMeshShape(parent);
rbc = new RigidBodyControl(terrainShape, 0);
rbc.setFriction(friction);
rbc.setCollisionGroup(collisionGroup);
parent.addControl(rbc);
rbc.setPhysicsLocation(backupTrans);
rbc.setPhysicsRotation(backupRotation);
rbc.setEnabled(true);
}
}
示例5: createFor
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
@Override
@FXThread
public <T, V extends TreeNode<T>> @Nullable V createFor(@Nullable final T element, final long objectId) {
if (element instanceof LayersRoot) {
return unsafeCast(new LayersRootTreeNode((LayersRoot) element, objectId));
} else if (element instanceof TerrainGrid) {
return unsafeCast(new TerrainGridTreeNode((TerrainGrid) element, objectId));
} else if (element instanceof TerrainQuad) {
return unsafeCast(new TerrainQuadTreeNode((TerrainQuad) element, objectId));
} else if (element instanceof SceneNode) {
return unsafeCast(new SceneNodeTreeNode((SceneNode) element, objectId));
} else if (element instanceof SceneLayer) {
return unsafeCast(new SceneLayerTreeNode((SceneLayer) element, objectId));
} else if (element instanceof Mesh) {
return unsafeCast(new MeshTreeNode((Mesh) element, objectId));
} else if (element instanceof Geometry) {
return unsafeCast(new GeometryTreeNode<>((Geometry) element, objectId));
} else if (element instanceof AudioNode) {
return unsafeCast(new AudioTreeNode((AudioNode) element, objectId));
} else if (element instanceof AssetLinkNode) {
return unsafeCast(new AssetLinkNodeTreeNode((AssetLinkNode) element, objectId));
} else if (element instanceof Node) {
return unsafeCast(new NodeTreeNode<>((Node) element, objectId));
} else if (element instanceof Material) {
return unsafeCast(new MaterialTreeNode((Material) element, objectId));
}
return null;
}
示例6: loadTerrain
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的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;
});
}
示例7: testHeightmapBuilding
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
private static void testHeightmapBuilding() {
int s = 9;
int b = 3;
float[] hm = new float[s * s];
for (int i = 0; i < s; i++) {
for (int j = 0; j < s; j++) {
hm[(i * s) + j] = i * j;
}
}
for (int i = 0; i < s; i++) {
for (int j = 0; j < s; j++) {
System.out.print(hm[i * s + j] + " ");
}
System.out.println("");
}
TerrainQuad terrain = new TerrainQuad("terrain", b, s, hm);
float[] hm2 = terrain.getHeightMap();
boolean failed = false;
for (int i = 0; i < s * s; i++) {
if (hm[i] != hm2[i]) {
failed = true;
}
}
System.out.println("");
if (failed) {
System.out.println("Terrain heightmap building FAILED!!!");
for (int i = 0; i < s; i++) {
for (int j = 0; j < s; j++) {
System.out.print(hm2[i * s + j] + " ");
}
System.out.println("");
}
} else {
System.out.println("Terrain heightmap building PASSED");
}
}
示例8: doApplyTool
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
@Override
protected Object doApplyTool(AbstractSceneExplorerNode rootNode, Object settings) {
WizardDescriptor wiz = (WizardDescriptor) settings;
if (wiz == null || wiz.getProperties() == null || wiz.getProperties().get("newName") == null)
return null;
newName = cleanFileName( wiz.getProperties().get("newName").toString() );
if (newName == null)
return null;
TerrainQuad quad = rootNode.getLookup().lookup(TerrainQuad.class);
rename(quad, oldName, newName);
return quad;
}
示例9: tileAttached
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
public void tileAttached(Vector3f vctrf, TerrainQuad tq) {
logger.log(Level.FINE, "Calling TerrainGrid update for node: {0}" + this);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
refresh(false);
}
});
}
示例10: tileDetached
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
public void tileDetached(Vector3f vctrf, TerrainQuad tq) {
logger.log(Level.FINE, "Calling TerrainGrid update for node: {0}" + this);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
refresh(false);
}
});
}
示例11: createNodes
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
@Override
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeTerrainQuad((TerrainQuad) key, children).setReadOnly(cookie)};
}
示例12: getRightQuad
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
/**
* 1 3
* 2 4
*/
public TerrainQuad getRightQuad(TerrainQuad center) {
//System.out.println("lookup neighbour");
if (center == terrain1)
return terrain3;
if (center == terrain2)
return terrain4;
return null;
}
示例13: getLeftQuad
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
/**
* 1 3
* 2 4
*/
public TerrainQuad getLeftQuad(TerrainQuad center) {
//System.out.println("lookup neighbour");
if (center == terrain3)
return terrain1;
if (center == terrain4)
return terrain2;
return null;
}
示例14: getTopQuad
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
/**
* 1 3
* 2 4
*/
public TerrainQuad getTopQuad(TerrainQuad center) {
//System.out.println("lookup neighbour");
if (center == terrain2)
return terrain1;
if (center == terrain4)
return terrain3;
return null;
}
示例15: getDownQuad
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
/**
* 1 3
* 2 4
*/
public TerrainQuad getDownQuad(TerrainQuad center) {
//System.out.println("lookup neighbour");
if (center == terrain1)
return terrain2;
if (center == terrain3)
return terrain4;
return null;
}