Skip to content

Commit 83768d1

Browse files
Update modifiers.md
1 parent c40f20c commit 83768d1

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

documentation/modifiers.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,55 @@ shapes and effects.
99

1010
By following these guidelines and understanding the core concepts of mesh modifiers, you can create a wide range of 3D models and effects.
1111

12+
The library offers a versatile set of pre-built modifiers, each adhering to the IMeshModifier interface. If you aim to extend the library with custom modifiers, ensuring adherence to this interface is crucial.
13+
14+
**Applying Modifications**
15+
16+
You can apply modifications to a mesh in two primary ways:
17+
18+
**1. Direct Modification:**
19+
20+
```java
21+
Mesh3D cube = new CubeCreator().create();
22+
ScaleModifier scaleModifier = new ScaleModifier(10);
23+
scaleModifier.modify(cube);
24+
```
25+
26+
**2. Mesh-Based Application:**
27+
28+
```java
29+
Mesh3D cube = new CubeCreator().create();
30+
ScaleModifier scaleModifier = new ScaleModifier(10);
31+
cube.apply(scaleModifier);
32+
```
33+
34+
The preferred approach depends on your specific use case and coding style. However,
35+
it's recommended to maintain consistency within your project to enhance code readability
36+
and maintainability.
37+
38+
**A Practical Example: Creating a Complex Shape**
39+
40+
To demonstrate the power of combining multiple modifiers, let's create a complex shape:
41+
42+
```java
43+
Mesh3D mesh = new CubeCreator().create();
44+
mesh.apply(new ExtrudeModifier(0.4f, 2));
45+
mesh.apply(new HolesModifier());
46+
mesh.apply(new SolidifyModifier(0.2f));
47+
mesh.apply(new ScaleModifier(1, 5, 1));
48+
mesh.apply(new RotateZModifier(Mathf.HALF_PI));
49+
mesh.apply(new CatmullClarkModifier(3));
50+
mesh.apply(new BendModifier(0.2f));
51+
```
52+
53+
By applying these modifiers sequentially, we can create a complex shape that
54+
starts as a simple cube and undergoes various transformations. This example
55+
highlights the flexibility and power of the mesh modifier framework.
56+
57+
**Remember:** The order in which modifiers are applied can significantly
58+
impact the final result. Experiment with different sequences to achieve
59+
desired effects.
60+
1261
## Best Practices for Using Mesh Modifiers
1362

1463
* **Start with Simple Shapes:** Begin with basic shapes like cubes, spheres, and planes to understand the effects of different modifiers.

0 commit comments

Comments
 (0)