-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Most of the port is pretty simple. The main problems are regarding changes to Minecraft's rendering system. - Remove several rendering tweaks until Forge's compatibility it brought up-to-date - Map rendering for pocket computers and printouts - Item frame rendering for printouts - Custom block outlines for monitors and cables/wired modems - Custom breaking progress for cables/wired modems - Turtle "Dinnerbone" rendering is currently broken, as normals are not correctly transformed. - Rewrite FixedWidthFontRenderer to to the buffer in a single sweep. In order to do this, the term_font now also bundles a "background" section, which is just a blank region of the screen. - Render monitors using a VBO instead of a call list. I haven't compared performance yet, but it manages to render a 6x5 array of _static_ monitors at almost 60fps, which seems pretty reasonable.
- Loading branch information
Showing
65 changed files
with
1,054 additions
and
1,520 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
61 changes: 61 additions & 0 deletions
61
src/main/java/dan200/computercraft/api/client/TransformedModel.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,61 @@ | ||
/* | ||
* This file is part of the public ComputerCraft API - http://www.computercraft.info | ||
* Copyright Daniel Ratcliffe, 2011-2020. This API may be redistributed unmodified and in full only. | ||
* For help using the API, and posting your mods, visit the forums at computercraft.info. | ||
*/ | ||
package dan200.computercraft.api.client; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.TransformationMatrix; | ||
import net.minecraft.client.renderer.model.IBakedModel; | ||
import net.minecraft.client.renderer.model.ModelManager; | ||
import net.minecraft.client.renderer.model.ModelResourceLocation; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Objects; | ||
|
||
/** | ||
* A model to render, combined with a transformation matrix to apply. | ||
*/ | ||
public final class TransformedModel | ||
{ | ||
private final IBakedModel model; | ||
private final TransformationMatrix matrix; | ||
|
||
public TransformedModel( @Nonnull IBakedModel model, @Nonnull TransformationMatrix matrix ) | ||
{ | ||
this.model = Objects.requireNonNull( model ); | ||
this.matrix = Objects.requireNonNull( matrix ); | ||
} | ||
|
||
public TransformedModel( @Nonnull IBakedModel model ) | ||
{ | ||
this.model = Objects.requireNonNull( model ); | ||
this.matrix = TransformationMatrix.identity(); | ||
} | ||
|
||
public static TransformedModel of( @Nonnull ModelResourceLocation location ) | ||
{ | ||
ModelManager modelManager = Minecraft.getInstance().getModelManager(); | ||
return new TransformedModel( modelManager.getModel( location ) ); | ||
} | ||
|
||
public static TransformedModel of( @Nonnull ItemStack item, @Nonnull TransformationMatrix transform ) | ||
{ | ||
IBakedModel model = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getItemModel( item ); | ||
return new TransformedModel( model, transform ); | ||
} | ||
|
||
@Nonnull | ||
public IBakedModel getModel() | ||
{ | ||
return model; | ||
} | ||
|
||
@Nonnull | ||
public TransformationMatrix getMatrix() | ||
{ | ||
return matrix; | ||
} | ||
} |
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.