forked from BuildCraft/BuildCraft
-
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.
- Loading branch information
Showing
5 changed files
with
79 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package buildcraft.lib.debug; | ||
|
||
import javax.vecmath.Point3f; | ||
import javax.vecmath.Tuple3f; | ||
|
||
import net.minecraft.client.renderer.VertexBuffer; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
import net.minecraftforge.client.model.ModelLoader; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
import buildcraft.lib.client.model.ModelUtil; | ||
import buildcraft.lib.client.model.MutableQuad; | ||
import buildcraft.lib.client.render.DetatchedRenderer.IDetachedRenderer; | ||
|
||
public enum DebugRenderHelper implements IDetachedRenderer { | ||
INSTANCE; | ||
|
||
private static final MutableQuad[] smallCuboid; | ||
|
||
static { | ||
smallCuboid = new MutableQuad[6]; | ||
Tuple3f center = new Point3f(0.5f, 0.5f, 0.5f); | ||
Tuple3f radius = new Point3f(0.25f, 0.25f, 0.25f); | ||
|
||
for (EnumFacing face : EnumFacing.VALUES) { | ||
MutableQuad quad = ModelUtil.createFace(face, center, radius, null); | ||
quad.lightf(1, 1); | ||
smallCuboid[face.ordinal()] = quad; | ||
} | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public void render(EntityPlayer player, float partialTicks) { | ||
IAdvDebugTarget target = BCAdvDebugging.INSTANCE.targetClient; | ||
if (target == null) { | ||
return; | ||
} else if (!target.doesExistInWorld()) { | ||
// targetClient = null; | ||
// return; | ||
} | ||
IDetachedRenderer renderer = target.getDebugRenderer(); | ||
if (renderer != null) { | ||
renderer.render(player, partialTicks); | ||
} | ||
} | ||
|
||
public static void renderSmallCuboid(VertexBuffer vb, BlockPos pos, int colour) { | ||
vb.setTranslation(pos.getX(), pos.getY(), pos.getZ()); | ||
for (MutableQuad q : smallCuboid) { | ||
q.texFromSprite(ModelLoader.White.INSTANCE); | ||
q.colouri(colour); | ||
q.render(vb); | ||
} | ||
vb.setTranslation(0, 0, 0); | ||
} | ||
} |
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