forked from FabricMC/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert MeshBuilder into MutableMesh
- Effectively split MeshBuilder#build into MutableMesh#immutableCopy and #clear - Effectively add MutableMesh#forEachMutable - Add Mesh#size - Remove QuadEmitter#hasTransform - Optimize MutableQuadViewImpl#copyFrom by not precomputing geometry - Give UnwrappableBakedModel#unwrap a default implementation to prevent issues with interface injection - Finish porting FRAPI and Model Loading API testmods
- Loading branch information
1 parent
386c4a9
commit 4b58d9c
Showing
28 changed files
with
375 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
...renderer-api-v1/src/client/java/net/fabricmc/fabric/api/renderer/v1/mesh/MeshBuilder.java
This file was deleted.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
...renderer-api-v1/src/client/java/net/fabricmc/fabric/api/renderer/v1/mesh/MutableMesh.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.api.renderer.v1.mesh; | ||
|
||
import java.util.function.Consumer; | ||
|
||
/** | ||
* A bundle of {@link MutableQuadView} instances encoded by the renderer that | ||
* can have more quads added to it. Typically used to build optimized, | ||
* immutable {@link Mesh}es via {@link #emitter()}, {@link #immutableCopy()}, | ||
* and {@link #clear()}. Encoded quads can also be inspected, modified, and | ||
* outputted directly to allow for advanced use cases where creating an | ||
* immutable {@link Mesh} is not desirable. | ||
* | ||
* <p>All declared methods in this interface are <b>not</b> thread-safe and | ||
* should not be used concurrently. Inherited methods from {@link Mesh} are | ||
* still thread-safe when used in isolation. | ||
* | ||
* <p>Only the renderer should implement or extend this interface. | ||
*/ | ||
public interface MutableMesh extends Mesh { | ||
/** | ||
* Returns the {@link QuadEmitter} used to append quads to this mesh. | ||
* Calling this method a second time invalidates any prior result. | ||
* Do not retain references outside the context of this mesh. | ||
*/ | ||
QuadEmitter emitter(); | ||
|
||
/** | ||
* Use to access all the quads encoded in this mesh and modify them as | ||
* necessary. The quad instance sent to the consumer should never be | ||
* retained outside the current call to the consumer. | ||
*/ | ||
void forEachMutable(Consumer<? super MutableQuadView> action); | ||
|
||
/** | ||
* Returns a new, optimized, immutable {@link Mesh} instance containing all | ||
* quads currently encoded in {@code this} mesh. This operation does not | ||
* change the state of {@code this} mesh; if you need to build another | ||
* immutable mesh, call {@link #clear()} first. | ||
* | ||
* <p>If quad data has been added to the {@link #emitter()} but has | ||
* not yet been emitted, calling this method will not affect it. | ||
*/ | ||
Mesh immutableCopy(); | ||
|
||
/** | ||
* Resets this mesh to an empty state with zero quads, effectively clearing | ||
* all existing quads. | ||
*/ | ||
void clear(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.