本文整理汇总了Java中com.jme3.terrain.geomipmap.TerrainQuad类的典型用法代码示例。如果您正苦于以下问题:Java TerrainQuad类的具体用法?Java TerrainQuad怎么用?Java TerrainQuad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TerrainQuad类属于com.jme3.terrain.geomipmap包,在下文中一共展示了TerrainQuad类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:TerrainEditingComponent.java
示例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);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:TerrainEditingComponent.java
示例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;
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:19,代码来源:JmeTerrainQuad.java
示例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);
}
}
开发者ID:samynk,项目名称:DArtE,代码行数:19,代码来源:PhysicsTerrainComponent.java
示例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;
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:31,代码来源:DefaultTreeNodeFactory.java
示例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;
});
}
开发者ID:ZoltanTheHun,项目名称:SkyHussars,代码行数:37,代码来源:TerrainManager.java
示例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");
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:40,代码来源:TerrainTestReadWrite.java
示例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;
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:15,代码来源:RenameTerrainAction.java
示例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);
}
});
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:9,代码来源:JmeTerrainGrid.java
示例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);
}
});
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:9,代码来源:JmeTerrainGrid.java
示例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)};
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:8,代码来源:JmeTerrainQuad.java
示例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;
}
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:14,代码来源:TerrainTestTile.java
示例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;
}
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:14,代码来源:TerrainTestTile.java
示例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;
}
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:14,代码来源:TerrainTestTile.java
示例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;
}
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:14,代码来源:TerrainTestTile.java
示例16: Player
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
public Player(AssetManager assetManager, TerrainQuad terrainTo) {
terrain = terrainTo;
playerNode = assetManager.loadModel("Models/template animations9/template animations9.j3o");
//Geometry geom = new Geometry("Spatial", b.g);
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.BlackNoAlpha); // set color of material to blue
playerNode.setLocalScale(10, 10, 10);
playerNode.setLocalTranslation(0, 0, 0);
playerNode.setMaterial(mat);
atTarget = true;
this.attachChild(playerNode);
projectile = new ParticleEmitter("Emitter", Type.Triangle, 30);
Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat_red.setColor("Color", ColorRGBA.Red);
projectile.setMaterial(mat_red);
projectile.setImagesX(2); projectile.setImagesY(2); // 2x2 texture animation
projectile.setEndColor( new ColorRGBA(1f, 0f, 0f, 1f)); // red
projectile.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
projectile.getParticleInfluencer().setInitialVelocity(new Vector3f(0,2,0));
projectile.setStartSize(1.5f);
projectile.setEndSize(0.1f);
projectile.setGravity(0,0,0);
projectile.setLowLife(0.5f);
projectile.setHighLife(3f);
projectile.getParticleInfluencer().setVelocityVariation(0.3f);
projectile.setNumParticles(200);
this.attachChild(projectile);
}
开发者ID:Patrik8008,项目名称:The-Game,代码行数:30,代码来源:Player.java
示例17: Hunter
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
public Hunter(AssetManager assetManager, TerrainQuad terrainTo) {
terrain = terrainTo;
playerNode = assetManager.loadModel("Models/template animations9/template animations9.j3o");
//Geometry geom = new Geometry("Spatial", b.g);
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue
playerNode.setLocalScale(10, 10, 10);
playerNode.setLocalTranslation(10, 0, 10);
playerNode.setMaterial(mat);
atTarget = true;
this.attachChild(playerNode);
}
开发者ID:Patrik8008,项目名称:The-Game,代码行数:14,代码来源:Hunter.java
示例18: checkForOldItems
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
private boolean checkForOldItems()
{
Iterator<Map.Entry<Vector3f, Node>> iterator = activeItems.entrySet().iterator();
while(iterator.hasNext())
{
Map.Entry<Vector3f, Node> entry = iterator.next();
Vector3f quadLocation = entry.getKey();
if (quadLocation.getX() < topLx || quadLocation.getX() > botRx || quadLocation.getZ() < topLz || quadLocation.getZ() > botRz)
{
TerrainQuad chunk = (TerrainQuad)entry.getValue();
// throw the tile unloaded event and check if the tile unload has been cancelled
if (!this.worldItemUnloaded(chunk))
return false;
app.getStateManager().getState(BulletAppState.class).getPhysicsSpace().remove(chunk);
app.getRootNode().detachChild(chunk);
iterator.remove();
return true;
}
}
return false;
}
开发者ID:jayfella,项目名称:World,代码行数:29,代码来源:World.java
示例19: TerrainQuadTreeNode
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
public TerrainQuadTreeNode(@NotNull final TerrainQuad element, final long objectId) {
super(element, objectId);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:4,代码来源:TerrainQuadTreeNode.java
示例20: isSupport
import com.jme3.terrain.geomipmap.TerrainQuad; //导入依赖的package包/类
@Override
public boolean isSupport(@NotNull final Object object) {
return object instanceof TerrainQuad;
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:5,代码来源:TerrainEditingComponent.java
注:本文中的com.jme3.terrain.geomipmap.TerrainQuad类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论