SDK:
- clean up NewGeometry actions
This commit is contained in:
parent
2e4a7a300e
commit
359e9d2d64
@ -54,24 +54,15 @@ public class NewGeometryBoxAction extends AbstractNewSpatialAction implements Ne
|
||||
|
||||
@Override
|
||||
protected Spatial doCreateSpatial(Node parent) {
|
||||
Geometry geom = box(pm);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
|
||||
static Material material(AssetManager assetManaget, NewGeometrySettings cfg) {
|
||||
Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
return mat;
|
||||
}
|
||||
|
||||
static Geometry box(AssetManager assetManager) {
|
||||
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||
Box b = new Box(cfg.getBoxX(), cfg.getBoxY(), cfg.getBoxZ());
|
||||
b.setMode(cfg.getBoxMode());
|
||||
Geometry geom = new Geometry(cfg.getBoxName(), b);
|
||||
geom.setMaterial(material(assetManager, cfg));
|
||||
Material mat = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
geom.setMaterial(mat);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
}
|
||||
|
@ -54,25 +54,15 @@ public class NewGeometryLineAction extends AbstractNewSpatialAction implements N
|
||||
|
||||
@Override
|
||||
protected Spatial doCreateSpatial(Node parent) {
|
||||
Geometry geom = line(pm);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
|
||||
static Material material(AssetManager assetManaget, NewGeometrySettings cfg) {
|
||||
Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
return mat;
|
||||
}
|
||||
|
||||
static Geometry line(AssetManager assetManager) {
|
||||
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||
Line b = new Line(cfg.getLineStart(), cfg.getLineEnd());
|
||||
b.setMode(cfg.getLineMode());
|
||||
Geometry geom = new Geometry(cfg.getLineName(), b);
|
||||
geom.setMaterial(material(assetManager, cfg));
|
||||
Material mat = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
geom.setMaterial(mat);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,19 +55,6 @@ public class NewGeometryQuadAction extends AbstractNewSpatialAction implements N
|
||||
|
||||
@Override
|
||||
protected Spatial doCreateSpatial(Node parent) {
|
||||
Geometry geom = quad(pm);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
|
||||
static Material material(AssetManager assetManaget, NewGeometrySettings cfg) {
|
||||
Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
return mat;
|
||||
}
|
||||
|
||||
static Geometry quad(AssetManager assetManager) {
|
||||
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||
Quad b = new Quad(cfg.getQuadWidth(), cfg.getQuadHeight(), cfg.getQuadFlipCoords());
|
||||
b.setMode(cfg.getQuadMode());
|
||||
@ -86,7 +73,11 @@ public class NewGeometryQuadAction extends AbstractNewSpatialAction implements N
|
||||
break;
|
||||
}
|
||||
}
|
||||
geom.setMaterial(material(assetManager, cfg));
|
||||
Material mat = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
geom.setMaterial(mat);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,19 +54,6 @@ public class NewGeometrySphereAction extends AbstractNewSpatialAction implements
|
||||
|
||||
@Override
|
||||
protected Spatial doCreateSpatial(Node parent) {
|
||||
Geometry geom = sphere(pm);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
|
||||
static Material material(AssetManager assetManaget, NewGeometrySettings cfg) {
|
||||
Material mat = new Material(assetManaget, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
return mat;
|
||||
}
|
||||
|
||||
static Geometry sphere(AssetManager assetManager) {
|
||||
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||
Sphere b = new Sphere(
|
||||
cfg.getSphereZSamples()
|
||||
@ -77,8 +64,11 @@ public class NewGeometrySphereAction extends AbstractNewSpatialAction implements
|
||||
);
|
||||
b.setMode(cfg.getSphereMode());
|
||||
Geometry geom = new Geometry(cfg.getSphereName(), b);
|
||||
geom.setMaterial(material(assetManager, cfg));
|
||||
Material mat = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
|
||||
mat.setColor("Color", c);
|
||||
geom.setMaterial(mat);
|
||||
parent.attachChild(geom);
|
||||
return geom;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user