SDK:
- clean up NewGeometry actions
This commit is contained in:
+5
-14
@@ -54,24 +54,15 @@ public class NewGeometryBoxAction extends AbstractNewSpatialAction implements Ne
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Spatial doCreateSpatial(Node parent) {
|
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();
|
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||||
Box b = new Box(cfg.getBoxX(), cfg.getBoxY(), cfg.getBoxZ());
|
Box b = new Box(cfg.getBoxX(), cfg.getBoxY(), cfg.getBoxZ());
|
||||||
b.setMode(cfg.getBoxMode());
|
b.setMode(cfg.getBoxMode());
|
||||||
Geometry geom = new Geometry(cfg.getBoxName(), b);
|
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;
|
return geom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-15
@@ -54,25 +54,15 @@ public class NewGeometryLineAction extends AbstractNewSpatialAction implements N
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Spatial doCreateSpatial(Node parent) {
|
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();
|
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||||
Line b = new Line(cfg.getLineStart(), cfg.getLineEnd());
|
Line b = new Line(cfg.getLineStart(), cfg.getLineEnd());
|
||||||
b.setMode(cfg.getLineMode());
|
b.setMode(cfg.getLineMode());
|
||||||
Geometry geom = new Geometry(cfg.getLineName(), b);
|
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;
|
return geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-15
@@ -55,19 +55,6 @@ public class NewGeometryQuadAction extends AbstractNewSpatialAction implements N
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Spatial doCreateSpatial(Node parent) {
|
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();
|
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||||
Quad b = new Quad(cfg.getQuadWidth(), cfg.getQuadHeight(), cfg.getQuadFlipCoords());
|
Quad b = new Quad(cfg.getQuadWidth(), cfg.getQuadHeight(), cfg.getQuadFlipCoords());
|
||||||
b.setMode(cfg.getQuadMode());
|
b.setMode(cfg.getQuadMode());
|
||||||
@@ -86,7 +73,11 @@ public class NewGeometryQuadAction extends AbstractNewSpatialAction implements N
|
|||||||
break;
|
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;
|
return geom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-15
@@ -54,19 +54,6 @@ public class NewGeometrySphereAction extends AbstractNewSpatialAction implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Spatial doCreateSpatial(Node parent) {
|
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();
|
NewGeometrySettings cfg = new NewGeometrySettings();
|
||||||
Sphere b = new Sphere(
|
Sphere b = new Sphere(
|
||||||
cfg.getSphereZSamples()
|
cfg.getSphereZSamples()
|
||||||
@@ -77,8 +64,11 @@ public class NewGeometrySphereAction extends AbstractNewSpatialAction implements
|
|||||||
);
|
);
|
||||||
b.setMode(cfg.getSphereMode());
|
b.setMode(cfg.getSphereMode());
|
||||||
Geometry geom = new Geometry(cfg.getSphereName(), b);
|
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;
|
return geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user