mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-20 12:19:39 +00:00
The *FANCIEST* thing.
This commit is contained in:
1 parent
db012a812e
commit
d5f1d896ea
25 files changed
+406
-20
No files matched your search
@@ -4,8 +4,10 @@ import fox.spiteful.avaritia.compat.CompatClient;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.render.CosmicItemRenderer;
|
||||
import fox.spiteful.avaritia.render.FancyHaloRenderer;
|
||||
import fox.spiteful.avaritia.render.LudicrousRenderEvents;
|
||||
import fox.spiteful.avaritia.render.ShaderHelper;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
@@ -22,6 +24,8 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
CompatClient.comprettify();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new LudicrousRenderEvents());
|
||||
|
||||
ShaderHelper.initShaders();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package fox.spiteful.avaritia.render;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import scala.actors.threadpool.Arrays;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
@@ -29,7 +34,6 @@ public class CosmicItemRenderer implements IItemRenderer {
|
||||
|
||||
private final ShaderCallback shaderCallback;
|
||||
private float[] lightlevel = new float[3];
|
||||
private ItemStack renderStack;
|
||||
|
||||
private String[] lightmapobf = new String[] {"lightmapColors", "field_78504_Q", "U"};
|
||||
|
||||
@@ -39,22 +43,33 @@ public class CosmicItemRenderer implements IItemRenderer {
|
||||
public void call(int shader) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
//int x = ARBShaderObjects.glGetUniformLocationARB(shader, "yaw");
|
||||
//ARBShaderObjects.glUniform1fARB(x, (float)((mc.thePlayer.rotationYaw * 2 * Math.PI) / 360.0));
|
||||
int x = ARBShaderObjects.glGetUniformLocationARB(shader, "yaw");
|
||||
ARBShaderObjects.glUniform1fARB(x, (float)((mc.thePlayer.rotationYaw * 2 * Math.PI) / 360.0));
|
||||
|
||||
//int z = ARBShaderObjects.glGetUniformLocationARB(shader, "pitch");
|
||||
//ARBShaderObjects.glUniform1fARB(z, - (float)((mc.thePlayer.rotationPitch * 2 * Math.PI) / 360.0));
|
||||
int z = ARBShaderObjects.glGetUniformLocationARB(shader, "pitch");
|
||||
ARBShaderObjects.glUniform1fARB(z, - (float)((mc.thePlayer.rotationPitch * 2 * Math.PI) / 360.0));
|
||||
|
||||
int l = ARBShaderObjects.glGetUniformLocationARB(shader, "lightlevel");
|
||||
ARBShaderObjects.glUniform3fARB(l, lightlevel[0], lightlevel[1], lightlevel[2]);
|
||||
|
||||
/*if (renderStack != null && renderStack.getItem() != null && renderStack.getItem() instanceof ICosmicRenderItem) {
|
||||
ICosmicRenderItem item = (ICosmicRenderItem)(renderStack.getItem());
|
||||
IIcon maskicon = item.getMaskTexture(renderStack);
|
||||
|
||||
int m = ARBShaderObjects.glGetUniformLocationARB(shader, "maskUV");
|
||||
ARBShaderObjects.glUniform4fARB(m, maskicon.getMinU(), maskicon.getMinV(), maskicon.getMaxU(), maskicon.getMaxV());
|
||||
}*/
|
||||
int lightmix = ARBShaderObjects.glGetUniformLocationARB(shader, "lightmix");
|
||||
ARBShaderObjects.glUniform1fARB(lightmix, 0.2f);
|
||||
|
||||
IIcon[] icons = LudicrousRenderEvents.cosmicIcons;
|
||||
FloatBuffer cosmicUVs = BufferUtils.createFloatBuffer(4 * icons.length);
|
||||
IIcon icon;
|
||||
for (int i=0; i<icons.length; i++) {
|
||||
icon = icons[i];
|
||||
|
||||
cosmicUVs.put(icon.getMinU());
|
||||
cosmicUVs.put(icon.getMinV());
|
||||
cosmicUVs.put(icon.getMaxU());
|
||||
cosmicUVs.put(icon.getMaxV());
|
||||
}
|
||||
cosmicUVs.flip();
|
||||
|
||||
int uvs = ARBShaderObjects.glGetUniformLocationARB(shader, "cosmicuvs");
|
||||
ARBShaderObjects.glUniformMatrix2ARB(uvs, false, cosmicUVs);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package fox.spiteful.avaritia.render;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
||||
import scala.actors.threadpool.Arrays;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
|
||||
public class LudicrousRenderEvents {
|
||||
|
||||
private static final int cosmicCount = 10;
|
||||
public static String[] cosmicTextures = new String[cosmicCount];
|
||||
|
||||
static {
|
||||
for (int i=0; i<cosmicCount; i++) {
|
||||
cosmicTextures[i] = "avaritia:cosmic"+i;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatBuffer cosmicUVs = null;
|
||||
public static IIcon[] cosmicIcons = new IIcon[cosmicTextures.length];
|
||||
|
||||
@SubscribeEvent
|
||||
public void letsMakeAQuilt(TextureStitchEvent.Pre event) {
|
||||
if (event.map.getTextureType() == 0) { return; }
|
||||
|
||||
for (int i=0; i<cosmicTextures.length; i++) {
|
||||
IIcon icon = event.map.registerIcon(cosmicTextures[i]);
|
||||
cosmicIcons[i] = icon;
|
||||
}
|
||||
|
||||
//Lumberjack.log(Level.INFO, "COSMIC QUILTING: "+Arrays.toString(cosmicIcons));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user