Revision af940c29
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/objects/FactoryCubit.java | ||
---|---|---|
2027 | 2027 |
|
2028 | 2028 |
MeshBase createCuboidMesh(int[] dimensions) |
2029 | 2029 |
{ |
2030 |
MeshBase mesh = createCuboid(dimensions);
|
|
2030 |
MeshBase mesh = createCuboid(dimensions); |
|
2031 | 2031 |
VertexEffect[] effects = createCuboidEffects(dimensions); |
2032 | 2032 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
2033 | 2033 |
|
2034 |
int X = dimensions[0]; |
|
2035 |
int Y = dimensions[1]; |
|
2036 |
int Z = dimensions[2]; |
|
2037 |
|
|
2038 |
float strength = 0.04f; |
|
2039 |
float radius = 0.15f; |
|
2040 |
|
|
2041 |
Static3D[] vertices = new Static3D[1]; |
|
2042 |
Static3D center; |
|
2043 |
|
|
2044 |
vertices[0] = new Static3D(+0.5f*X,+0.5f*Y,+0.5f*Z); |
|
2045 |
center = new Static3D(+0.5f*(X-1),+0.5f*(Y-1),+0.5f*(Z-1)); |
|
2046 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2047 |
|
|
2048 |
vertices[0] = new Static3D(+0.5f*X,+0.5f*Y,-0.5f*Z); |
|
2049 |
center = new Static3D(+0.5f*(X-1),+0.5f*(Y-1),-0.5f*(Z-1)); |
|
2050 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2051 |
|
|
2052 |
vertices[0] = new Static3D(+0.5f*X,-0.5f*Y,+0.5f*Z); |
|
2053 |
center = new Static3D(+0.5f*(X-1),-0.5f*(Y-1),+0.5f*(Z-1)); |
|
2054 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2055 |
|
|
2056 |
vertices[0] = new Static3D(+0.5f*X,-0.5f*Y,-0.5f*Z); |
|
2057 |
center = new Static3D(+0.5f*(X-1),-0.5f*(Y-1),-0.5f*(Z-1)); |
|
2058 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2059 |
|
|
2060 |
vertices[0] = new Static3D(-0.5f*X,+0.5f*Y,+0.5f*Z); |
|
2061 |
center = new Static3D(-0.5f*(X-1),+0.5f*(Y-1),+0.5f*(Z-1)); |
|
2062 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2063 |
|
|
2064 |
vertices[0] = new Static3D(-0.5f*X,+0.5f*Y,-0.5f*Z); |
|
2065 |
center = new Static3D(-0.5f*(X-1),+0.5f*(Y-1),-0.5f*(Z-1)); |
|
2066 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2067 |
|
|
2068 |
vertices[0] = new Static3D(-0.5f*X,-0.5f*Y,+0.5f*Z); |
|
2069 |
center = new Static3D(-0.5f*(X-1),-0.5f*(Y-1),+0.5f*(Z-1)); |
|
2070 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2071 |
|
|
2072 |
vertices[0] = new Static3D(-0.5f*X,-0.5f*Y,-0.5f*Z); |
|
2073 |
center = new Static3D(-0.5f*(X-1),-0.5f*(Y-1),-0.5f*(Z-1)); |
|
2074 |
roundCorners(mesh, center, vertices, strength, radius); |
|
2075 |
|
|
2034 | 2076 |
mesh.mergeEffComponents(); |
2035 | 2077 |
|
2036 | 2078 |
return mesh; |
Also available in: Unified diff
Progress with bandaged cubes.