Skip to content

Commit aa9e121

Browse files
committed
jme3-examples: convert tabs to spaces
1 parent d83d7a4 commit aa9e121

File tree

4 files changed

+287
-288
lines changed

4 files changed

+287
-288
lines changed

jme3-examples/src/main/java/jme3test/games/CubeField.java

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,17 @@ private void gameLost(){
248248
* Core Game Logic
249249
*/
250250
private void gameLogic(float tpf){
251-
//Subtract difficulty level in accordance to speed every 10 seconds
252-
if(timer.getTimeInSeconds()>=coreTime2){
253-
coreTime2=timer.getTimeInSeconds()+10;
254-
if(difficulty<=lowCap){
255-
difficulty=lowCap;
256-
}
257-
else if(difficulty>lowCap){
258-
difficulty-=5;
259-
}
260-
}
261-
251+
//Subtract difficulty level in accordance to speed every 10 seconds
252+
if(timer.getTimeInSeconds()>=coreTime2){
253+
coreTime2=timer.getTimeInSeconds()+10;
254+
if(difficulty<=lowCap){
255+
difficulty=lowCap;
256+
}
257+
else if(difficulty>lowCap){
258+
difficulty-=5;
259+
}
260+
}
261+
262262
if(speed<.1f){
263263
speed+=.000001f*tpf*fpsRate;
264264
}
@@ -274,8 +274,8 @@ else if(difficulty>lowCap){
274274
requestClose(false);
275275
}else{
276276
for (int i = 0; i < cubeField.size(); i++){
277-
278-
//better way to check collision
277+
278+
//better way to check collision
279279
Geometry playerModel = (Geometry) player.getChild(0);
280280
Geometry cubeModel = cubeField.get(i);
281281

@@ -327,73 +327,73 @@ public void onAnalog(String binding, float value, float tpf) {
327327
* Determines the colors of the player, floor, obstacle and background
328328
*/
329329
private void colorLogic() {
330-
if (timer.getTimeInSeconds() >= coreTime){
330+
if (timer.getTimeInSeconds() >= coreTime){
331331

332-
colorInt++;
332+
colorInt++;
333333
coreTime = timer.getTimeInSeconds() + 20;
334334

335335

336-
switch (colorInt){
337-
case 1:
338-
obstacleColors.clear();
339-
solidBox = false;
340-
obstacleColors.add(ColorRGBA.Green);
341-
renderer.setBackgroundColor(ColorRGBA.Black);
342-
playerMaterial.setColor("Color", ColorRGBA.White);
343-
floorMaterial.setColor("Color", ColorRGBA.Black);
344-
break;
345-
case 2:
346-
obstacleColors.set(0, ColorRGBA.Black);
347-
solidBox = true;
348-
renderer.setBackgroundColor(ColorRGBA.White);
349-
playerMaterial.setColor("Color", ColorRGBA.Gray);
336+
switch (colorInt){
337+
case 1:
338+
obstacleColors.clear();
339+
solidBox = false;
340+
obstacleColors.add(ColorRGBA.Green);
341+
renderer.setBackgroundColor(ColorRGBA.Black);
342+
playerMaterial.setColor("Color", ColorRGBA.White);
343+
floorMaterial.setColor("Color", ColorRGBA.Black);
344+
break;
345+
case 2:
346+
obstacleColors.set(0, ColorRGBA.Black);
347+
solidBox = true;
348+
renderer.setBackgroundColor(ColorRGBA.White);
349+
playerMaterial.setColor("Color", ColorRGBA.Gray);
350350
floorMaterial.setColor("Color", ColorRGBA.LightGray);
351-
break;
352-
case 3:
353-
obstacleColors.set(0, ColorRGBA.Pink);
354-
break;
355-
case 4:
356-
obstacleColors.set(0, ColorRGBA.Cyan);
357-
obstacleColors.add(ColorRGBA.Magenta);
358-
renderer.setBackgroundColor(ColorRGBA.Gray);
351+
break;
352+
case 3:
353+
obstacleColors.set(0, ColorRGBA.Pink);
354+
break;
355+
case 4:
356+
obstacleColors.set(0, ColorRGBA.Cyan);
357+
obstacleColors.add(ColorRGBA.Magenta);
358+
renderer.setBackgroundColor(ColorRGBA.Gray);
359359
floorMaterial.setColor("Color", ColorRGBA.Gray);
360-
playerMaterial.setColor("Color", ColorRGBA.White);
361-
break;
362-
case 5:
363-
obstacleColors.remove(0);
364-
renderer.setBackgroundColor(ColorRGBA.Pink);
365-
solidBox = false;
366-
playerMaterial.setColor("Color", ColorRGBA.White);
367-
break;
368-
case 6:
369-
obstacleColors.set(0, ColorRGBA.White);
370-
solidBox = true;
371-
renderer.setBackgroundColor(ColorRGBA.Black);
372-
playerMaterial.setColor("Color", ColorRGBA.Gray);
360+
playerMaterial.setColor("Color", ColorRGBA.White);
361+
break;
362+
case 5:
363+
obstacleColors.remove(0);
364+
renderer.setBackgroundColor(ColorRGBA.Pink);
365+
solidBox = false;
366+
playerMaterial.setColor("Color", ColorRGBA.White);
367+
break;
368+
case 6:
369+
obstacleColors.set(0, ColorRGBA.White);
370+
solidBox = true;
371+
renderer.setBackgroundColor(ColorRGBA.Black);
372+
playerMaterial.setColor("Color", ColorRGBA.Gray);
373373
floorMaterial.setColor("Color", ColorRGBA.LightGray);
374-
break;
375-
case 7:
376-
obstacleColors.set(0, ColorRGBA.Green);
377-
renderer.setBackgroundColor(ColorRGBA.Gray);
378-
playerMaterial.setColor("Color", ColorRGBA.Black);
374+
break;
375+
case 7:
376+
obstacleColors.set(0, ColorRGBA.Green);
377+
renderer.setBackgroundColor(ColorRGBA.Gray);
378+
playerMaterial.setColor("Color", ColorRGBA.Black);
379379
floorMaterial.setColor("Color", ColorRGBA.Orange);
380-
break;
381-
case 8:
382-
obstacleColors.set(0, ColorRGBA.Red);
380+
break;
381+
case 8:
382+
obstacleColors.set(0, ColorRGBA.Red);
383383
floorMaterial.setColor("Color", ColorRGBA.Pink);
384-
break;
385-
case 9:
386-
obstacleColors.set(0, ColorRGBA.Orange);
387-
obstacleColors.add(ColorRGBA.Red);
388-
obstacleColors.add(ColorRGBA.Yellow);
389-
renderer.setBackgroundColor(ColorRGBA.White);
390-
playerMaterial.setColor("Color", ColorRGBA.Red);
391-
floorMaterial.setColor("Color", ColorRGBA.Gray);
392-
colorInt=0;
393-
break;
394-
default:
395-
break;
396-
}
384+
break;
385+
case 9:
386+
obstacleColors.set(0, ColorRGBA.Orange);
387+
obstacleColors.add(ColorRGBA.Red);
388+
obstacleColors.add(ColorRGBA.Yellow);
389+
renderer.setBackgroundColor(ColorRGBA.White);
390+
playerMaterial.setColor("Color", ColorRGBA.Red);
391+
floorMaterial.setColor("Color", ColorRGBA.Gray);
392+
colorInt=0;
393+
break;
394+
default:
395+
break;
396+
}
397397
}
398398
}
399399
/**

jme3-examples/src/main/java/jme3test/model/anim/TestCustomAnim.java

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -54,99 +54,99 @@
5454

5555
public class TestCustomAnim extends SimpleApplication {
5656

57-
private Joint bone;
58-
private Armature armature;
59-
final private Quaternion rotation = new Quaternion();
60-
61-
public static void main(String[] args) {
62-
TestCustomAnim app = new TestCustomAnim();
63-
app.start();
64-
}
65-
66-
@Override
67-
public void simpleInitApp() {
68-
69-
AmbientLight al = new AmbientLight();
70-
rootNode.addLight(al);
71-
72-
DirectionalLight dl = new DirectionalLight();
73-
dl.setDirection(Vector3f.UNIT_XYZ.negate());
74-
rootNode.addLight(dl);
75-
76-
Box box = new Box(1, 1, 1);
77-
78-
VertexBuffer weightsHW = new VertexBuffer(Type.HWBoneWeight);
79-
VertexBuffer indicesHW = new VertexBuffer(Type.HWBoneIndex);
80-
indicesHW.setUsage(Usage.CpuOnly);
81-
weightsHW.setUsage(Usage.CpuOnly);
82-
box.setBuffer(weightsHW);
83-
box.setBuffer(indicesHW);
84-
85-
// Setup bone weight buffer
86-
FloatBuffer weights = FloatBuffer.allocate(box.getVertexCount() * 4);
87-
VertexBuffer weightsBuf = new VertexBuffer(Type.BoneWeight);
88-
weightsBuf.setupData(Usage.CpuOnly, 4, Format.Float, weights);
89-
box.setBuffer(weightsBuf);
90-
91-
// Setup bone index buffer
92-
ByteBuffer indices = ByteBuffer.allocate(box.getVertexCount() * 4);
93-
VertexBuffer indicesBuf = new VertexBuffer(Type.BoneIndex);
94-
indicesBuf.setupData(Usage.CpuOnly, 4, Format.UnsignedByte, indices);
95-
box.setBuffer(indicesBuf);
96-
97-
// Create bind pose buffers
98-
box.generateBindPose();
99-
100-
// Create skeleton
101-
bone = new Joint("root");
102-
bone.setLocalTransform(new Transform(Vector3f.ZERO, Quaternion.IDENTITY, Vector3f.UNIT_XYZ));
103-
armature = new Armature(new Joint[] { bone });
104-
105-
// Assign all vertices to bone 0 with weight 1
106-
for (int i = 0; i < box.getVertexCount() * 4; i += 4) {
107-
// assign vertex to bone index 0
108-
indices.array()[i + 0] = 0;
109-
indices.array()[i + 1] = 0;
110-
indices.array()[i + 2] = 0;
111-
indices.array()[i + 3] = 0;
112-
113-
// set weight to 1 only for first entry
114-
weights.array()[i + 0] = 1;
115-
weights.array()[i + 1] = 0;
116-
weights.array()[i + 2] = 0;
117-
weights.array()[i + 3] = 0;
118-
}
119-
120-
// Maximum number of weights per bone is 1
121-
box.setMaxNumWeights(1);
122-
123-
// Create model
124-
Geometry geom = new Geometry("box", box);
125-
geom.setMaterial(assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"));
126-
Node model = new Node("model");
127-
model.attachChild(geom);
128-
129-
// Create skeleton control
130-
SkinningControl skinningControl = new SkinningControl(armature);
131-
model.addControl(skinningControl);
132-
133-
rootNode.attachChild(model);
134-
}
135-
136-
@Override
137-
public void simpleUpdate(float tpf) {
138-
// Rotate around X axis
139-
Quaternion rotate = new Quaternion();
140-
rotate.fromAngleAxis(tpf, Vector3f.UNIT_X);
141-
142-
// Combine rotation with previous
143-
rotation.multLocal(rotate);
144-
145-
// Set new rotation into bone
146-
bone.setLocalTransform(new Transform(Vector3f.ZERO, rotation, Vector3f.UNIT_XYZ));
147-
148-
// After changing skeleton transforms, must update world data
149-
armature.update();
150-
}
57+
private Joint bone;
58+
private Armature armature;
59+
final private Quaternion rotation = new Quaternion();
60+
61+
public static void main(String[] args) {
62+
TestCustomAnim app = new TestCustomAnim();
63+
app.start();
64+
}
65+
66+
@Override
67+
public void simpleInitApp() {
68+
69+
AmbientLight al = new AmbientLight();
70+
rootNode.addLight(al);
71+
72+
DirectionalLight dl = new DirectionalLight();
73+
dl.setDirection(Vector3f.UNIT_XYZ.negate());
74+
rootNode.addLight(dl);
75+
76+
Box box = new Box(1, 1, 1);
77+
78+
VertexBuffer weightsHW = new VertexBuffer(Type.HWBoneWeight);
79+
VertexBuffer indicesHW = new VertexBuffer(Type.HWBoneIndex);
80+
indicesHW.setUsage(Usage.CpuOnly);
81+
weightsHW.setUsage(Usage.CpuOnly);
82+
box.setBuffer(weightsHW);
83+
box.setBuffer(indicesHW);
84+
85+
// Setup bone weight buffer
86+
FloatBuffer weights = FloatBuffer.allocate(box.getVertexCount() * 4);
87+
VertexBuffer weightsBuf = new VertexBuffer(Type.BoneWeight);
88+
weightsBuf.setupData(Usage.CpuOnly, 4, Format.Float, weights);
89+
box.setBuffer(weightsBuf);
90+
91+
// Setup bone index buffer
92+
ByteBuffer indices = ByteBuffer.allocate(box.getVertexCount() * 4);
93+
VertexBuffer indicesBuf = new VertexBuffer(Type.BoneIndex);
94+
indicesBuf.setupData(Usage.CpuOnly, 4, Format.UnsignedByte, indices);
95+
box.setBuffer(indicesBuf);
96+
97+
// Create bind pose buffers
98+
box.generateBindPose();
99+
100+
// Create skeleton
101+
bone = new Joint("root");
102+
bone.setLocalTransform(new Transform(Vector3f.ZERO, Quaternion.IDENTITY, Vector3f.UNIT_XYZ));
103+
armature = new Armature(new Joint[] { bone });
104+
105+
// Assign all vertices to bone 0 with weight 1
106+
for (int i = 0; i < box.getVertexCount() * 4; i += 4) {
107+
// assign vertex to bone index 0
108+
indices.array()[i + 0] = 0;
109+
indices.array()[i + 1] = 0;
110+
indices.array()[i + 2] = 0;
111+
indices.array()[i + 3] = 0;
112+
113+
// set weight to 1 only for first entry
114+
weights.array()[i + 0] = 1;
115+
weights.array()[i + 1] = 0;
116+
weights.array()[i + 2] = 0;
117+
weights.array()[i + 3] = 0;
118+
}
119+
120+
// Maximum number of weights per bone is 1
121+
box.setMaxNumWeights(1);
122+
123+
// Create model
124+
Geometry geom = new Geometry("box", box);
125+
geom.setMaterial(assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"));
126+
Node model = new Node("model");
127+
model.attachChild(geom);
128+
129+
// Create skeleton control
130+
SkinningControl skinningControl = new SkinningControl(armature);
131+
model.addControl(skinningControl);
132+
133+
rootNode.attachChild(model);
134+
}
135+
136+
@Override
137+
public void simpleUpdate(float tpf) {
138+
// Rotate around X axis
139+
Quaternion rotate = new Quaternion();
140+
rotate.fromAngleAxis(tpf, Vector3f.UNIT_X);
141+
142+
// Combine rotation with previous
143+
rotation.multLocal(rotate);
144+
145+
// Set new rotation into bone
146+
bone.setLocalTransform(new Transform(Vector3f.ZERO, rotation, Vector3f.UNIT_XYZ));
147+
148+
// After changing skeleton transforms, must update world data
149+
armature.update();
150+
}
151151

152152
}

jme3-examples/src/main/java/jme3test/model/anim/TestSkeletonControlRefresh.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void simpleInitApp() {
104104
for (AnimClip animClip : animComposer.getAnimClips()) {
105105
Action action = animComposer.action(animClip.getName());
106106
animComposer.addAction(animClip.getName(), new BaseAction(
107-
Tweens.sequence(action, Tweens.callMethod(animComposer, "removeCurrentAction", AnimComposer.DEFAULT_LAYER))));
107+
Tweens.sequence(action, Tweens.callMethod(animComposer, "removeCurrentAction", AnimComposer.DEFAULT_LAYER))));
108108
}
109109
animComposer.setCurrentAction(new ArrayList<>(animComposer.getAnimClips()).get((i + j) % 4).getName());
110110

0 commit comments

Comments
 (0)