Merge remote-tracking branch 'origin/replace-universium' into dev

This commit is contained in:
Martin Robertz committed 2026-02-06 19:59:08 +01:00
commit 34d91edf40
32 files changed
+32 -954

No files matched your search

+5 -6
View File
@@ -1,13 +1,14 @@
// Add your dependencies here
dependencies {
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.31-GTNH:dev")
api("com.github.GTNewHorizons:GTNHLib:0.8.32:dev")
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.40-GTNH:dev")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.2:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:Botania:1.13.4-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:Botania:1.13.6-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:Mantle:0.5.1:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.14.6-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:BloodMagic:1.8.5") {transitive = false}
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.14.15-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:BloodMagic:1.8.7") {transitive = false}
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.4.2:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.11:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.97:dev") {
@@ -20,6 +21,4 @@ dependencies {
compileOnly("curse.maven:cofh-lib-220333:2388748") {transitive = false}
compileOnly("curse.maven:cofh-core-69162:2388751") {transitive = false}
compileOnly("curse.maven:witchery-69673:2234410") {transitive = false}
runtimeOnly("com.github.GTNewHorizons:GTNHLib:0.9.0:dev")
}
@@ -37,7 +37,6 @@ public class Avaritia {
@SidedProxy(serverSide = "fox.spiteful.avaritia.CommonProxy", clientSide = "fox.spiteful.avaritia.ClientProxy")
public static CommonProxy proxy;
public static final boolean isHodgepodgeLoaded = Loader.isModLoaded("hodgepodge");
public static final boolean isDreamCraftLoaded = Loader.isModLoaded("dreamcraft");
public static CreativeTabs tab = new CreativeTabs("avaritia") {
@@ -19,7 +19,6 @@ import fox.spiteful.avaritia.render.FracturedOreRenderer;
import fox.spiteful.avaritia.render.LudicrousRenderEvents;
import fox.spiteful.avaritia.render.RenderGapingVoid;
import fox.spiteful.avaritia.render.RenderHeavenArrow;
import fox.spiteful.avaritia.render.ShaderHelper;
public class ClientProxy extends CommonProxy {
@@ -67,8 +66,6 @@ public class ClientProxy extends CommonProxy {
LudicrousRenderEvents fancyevents = new LudicrousRenderEvents();
MinecraftForge.EVENT_BUS.register(fancyevents);
FMLCommonHandler.instance().bus().register(fancyevents);
ShaderHelper.initShaders();
}
@Override
@@ -5,8 +5,7 @@ import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@@ -20,7 +19,6 @@ public class CosmicItemRenderer implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
// return type != ItemRenderType.INVENTORY;
return true;
}
@@ -33,7 +31,6 @@ public class CosmicItemRenderer implements IItemRenderer {
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
Minecraft mc = Minecraft.getMinecraft();
this.processLightLevel(type, item, data);
// ShaderHelper.useShader(ShaderHelper.testShader, this.shaderCallback);
switch (type) {
case ENTITY: {
GL11.glPushMatrix();
@@ -41,14 +38,9 @@ public class CosmicItemRenderer implements IItemRenderer {
if (item.isOnItemFrame()) GL11.glTranslatef(0F, -0.3F, 0.01F);
render(item, null);
GL11.glPopMatrix();
break;
}
case EQUIPPED: {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null);
break;
}
case EQUIPPED_FIRST_PERSON: {
case EQUIPPED, EQUIPPED_FIRST_PERSON: {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null);
break;
}
@@ -80,7 +72,7 @@ public class CosmicItemRenderer implements IItemRenderer {
IIcon cosmicicon = icri.getMaskTexture(item, null);
GL11.glColor4d(1, 1, 1, 1);
GL11.glColor4f(1, 1, 1, 1);
float minu = cosmicicon.getMinU();
float maxu = cosmicicon.getMaxU();
@@ -113,9 +105,6 @@ public class CosmicItemRenderer implements IItemRenderer {
default:
break;
}
// ShaderHelper.releaseShader();
// Lumberjack.log(Level.INFO, light+"");
}
public void render(ItemStack item, EntityPlayer player) {
@@ -128,22 +117,16 @@ public class CosmicItemRenderer implements IItemRenderer {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
// ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(),
// scale);
float r, g, b;
IIcon icon;
float f, f1, f2, f3;
float scale = 1F / 16F;
// Lumberjack.log(Level.INFO, "passes: "+passes);
final Tessellator tess = Tessellator.instance;
for (int i = 0; i < passes; i++) {
icon = this.getStackIcon(item, i, player);
// Lumberjack.log(Level.INFO, "icon "+i+": "+icon);
f = icon.getMinU();
f1 = icon.getMaxU();
f2 = icon.getMinV();
@@ -192,8 +175,8 @@ public class CosmicItemRenderer implements IItemRenderer {
public void processLightLevel(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case ENTITY: {
EntityItem ent = (EntityItem) (data[1]);
case ENTITY, EQUIPPED, EQUIPPED_FIRST_PERSON: {
Entity ent = (Entity) (data[1]);
if (ent != null) {
CosmicRenderShenanigans.setLightFromLocation(
ent.worldObj,
@@ -203,35 +186,8 @@ public class CosmicItemRenderer implements IItemRenderer {
}
break;
}
case EQUIPPED: {
EntityLivingBase ent = (EntityLivingBase) (data[1]);
if (ent != null) {
CosmicRenderShenanigans.setLightFromLocation(
ent.worldObj,
MathHelper.floor_double(ent.posX),
MathHelper.floor_double(ent.posY),
MathHelper.floor_double(ent.posZ));
}
break;
}
case EQUIPPED_FIRST_PERSON: {
EntityLivingBase ent = (EntityLivingBase) (data[1]);
if (ent != null) {
CosmicRenderShenanigans.setLightFromLocation(
ent.worldObj,
MathHelper.floor_double(ent.posX),
MathHelper.floor_double(ent.posY),
MathHelper.floor_double(ent.posZ));
}
break;
}
case INVENTORY: {
CosmicRenderShenanigans.setLightLevel(1.2f);
return;
}
default: {
CosmicRenderShenanigans.setLightLevel(1.0f);
return;
}
}
}
@@ -4,102 +4,39 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.world.World;
import org.lwjgl.opengl.ARBShaderObjects;
import com.gtnewhorizon.gtnhlib.client.renderer.postprocessing.shaders.UniversiumShader;
import com.gtnewhorizon.gtnhlib.client.renderer.shader.ShaderProgram;
public class CosmicRenderShenanigans {
public static final ShaderCallback shaderCallback;
public static float[] lightlevel = new float[3];
public static boolean inventoryRender = false;
public static float cosmicOpacity = 1.0f;
static {
shaderCallback = new ShaderCallback() {
@Override
public void call(int shader) {
Minecraft mc = Minecraft.getMinecraft();
float yaw = 0;
float pitch = 0;
float scale = 1.0f;
if (!inventoryRender) {
yaw = (float) ((mc.thePlayer.rotationYaw * 2 * Math.PI) / 360.0);
pitch = -(float) ((mc.thePlayer.rotationPitch * 2 * Math.PI) / 360.0);
} else {
scale = 25.0f;
}
int time2 = ARBShaderObjects.glGetUniformLocationARB(shader, "time2");
ARBShaderObjects.glUniform1fARB(time2, mc.thePlayer.ticksExisted);
int x = ARBShaderObjects.glGetUniformLocationARB(shader, "yaw");
ARBShaderObjects.glUniform1fARB(x, yaw);
int z = ARBShaderObjects.glGetUniformLocationARB(shader, "pitch");
ARBShaderObjects.glUniform1fARB(z, pitch);
int l = ARBShaderObjects.glGetUniformLocationARB(shader, "lightlevel");
ARBShaderObjects.glUniform3fARB(l, lightlevel[0], lightlevel[1], lightlevel[2]);
int lightmix = ARBShaderObjects.glGetUniformLocationARB(shader, "lightmix");
ARBShaderObjects.glUniform1fARB(lightmix, 0.2f);
int uvs = ARBShaderObjects.glGetUniformLocationARB(shader, "cosmicuvs");
ARBShaderObjects.glUniformMatrix2ARB(uvs, false, LudicrousRenderEvents.cosmicUVs);
int s = ARBShaderObjects.glGetUniformLocationARB(shader, "externalScale");
ARBShaderObjects.glUniform1fARB(s, scale);
int o = ARBShaderObjects.glGetUniformLocationARB(shader, "opacity");
ARBShaderObjects.glUniform1fARB(o, cosmicOpacity);
}
};
}
public static void useShader() {
ShaderHelper.useShader(ShaderHelper.cosmicShader, shaderCallback);
final UniversiumShader shader = UniversiumShader.getInstance();
if (inventoryRender) {
shader.setRenderInInventory();
}
if (cosmicOpacity != 1.0f) {
shader.setCosmicOpacity(cosmicOpacity);
}
shader.use();
}
public static void releaseShader() {
ShaderHelper.releaseShader();
ShaderProgram.unbind();
}
public static void setLightFromLocation(World world, int x, int y, int z) {
if (world == null) {
setLightLevel(1.0f);
return;
}
int coord = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
int[] map = Minecraft.getMinecraft().entityRenderer.lightmapColors;
if (map == null) {
setLightLevel(1.0f);
return;
}
int mx = (coord % 65536) / 16;
int my = (coord / 65536) / 16;
int lightcolour = map[Math.max(0, Math.min(map.length - 1, my * 16 + mx))];
setLightLevel(
((lightcolour >> 16) & 0xFF) / 256.0f,
((lightcolour >> 8) & 0xFF) / 256.0f,
((lightcolour) & 0xFF) / 256.0f);
UniversiumShader.getInstance().setLightFromLocation(world, x, y, z);
}
public static void setLightLevel(float level) {
setLightLevel(level, level, level);
UniversiumShader.getInstance().setLightLevel(level);
}
public static void setLightLevel(float r, float g, float b) {
lightlevel[0] = Math.max(0.0f, Math.min(1.0f, r));
lightlevel[1] = Math.max(0.0f, Math.min(1.0f, g));
lightlevel[2] = Math.max(0.0f, Math.min(1.0f, b));
UniversiumShader.getInstance().setLightLevel(r, g, b);
}
public static void bindItemTexture() {
@@ -17,6 +17,8 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.gtnewhorizon.gtnhlib.client.renderer.postprocessing.shaders.UniversiumShader;
import fox.spiteful.avaritia.items.ItemFracturedOre;
import fox.spiteful.avaritia.items.ItemFracturedOre.NameStack;
@@ -265,7 +267,7 @@ public class FracturedOreRenderer implements IItemRenderer {
GL11.glDisable(GL11.GL_BLEND);
if (!CosmicRenderShenanigans.inventoryRender) {
if (!UniversiumShader.isRenderingInInventory()) {
mc.entityRenderer.enableLightmap(0.0);
GL11.glEnable(GL11.GL_LIGHTING);
}
@@ -1,46 +1,19 @@
package fox.spiteful.avaritia.render;
import java.nio.FloatBuffer;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
import fox.spiteful.avaritia.Avaritia;
public class LudicrousRenderEvents {
private static final int cosmicCount = 10;
public static final String[] cosmicTextures = new String[cosmicCount];
static {
for (int i = 0; i < cosmicCount; i++) {
cosmicTextures[i] = "avaritia:cosmic" + i;
}
}
public static final FloatBuffer cosmicUVs = BufferUtils.createFloatBuffer(4 * cosmicTextures.length);
public static final IIcon[] cosmicIcons = new IIcon[cosmicTextures.length];
@SubscribeEvent
public void letsMakeAQuilt(TextureStitchEvent.Pre event) {
if (event.map.getTextureType() != 1) {
return;
}
for (int i = 0; i < cosmicTextures.length; i++) {
IIcon icon = event.map.registerIcon(cosmicTextures[i]);
cosmicIcons[i] = icon;
}
ModelArmorInfinity.overlayIcon = event.map.registerIcon("avaritia:infinity_armor_mask");
ModelArmorInfinity.invulnOverlayIcon = event.map.registerIcon("avaritia:infinity_armor_mask2");
ModelArmorInfinity.wingOverlayIcon = event.map.registerIcon("avaritia:infinity_armor_wingmask");
@@ -59,31 +32,4 @@ public class LudicrousRenderEvents {
ModelArmorInfinity.armorModel.rebuildOverlay();
ModelArmorInfinity.legModel.rebuildOverlay();
}
@SubscribeEvent
public void pushTheCosmicFancinessToTheLimit(RenderTickEvent event) {
if (event.phase == Phase.START) {
for (IIcon icon : cosmicIcons) {
if (Avaritia.isHodgepodgeLoaded
&& icon instanceof IPatchedTextureAtlasSprite patchedTextureAtlasSprite) {
patchedTextureAtlasSprite.markNeedsAnimationUpdate();
}
cosmicUVs.put(icon.getMinU());
cosmicUVs.put(icon.getMinV());
cosmicUVs.put(icon.getMaxU());
cosmicUVs.put(icon.getMaxV());
}
cosmicUVs.flip();
}
}
@SubscribeEvent
public void makeCosmicStuffLessDumbInGUIs(GuiScreenEvent.DrawScreenEvent.Pre event) {
CosmicRenderShenanigans.inventoryRender = true;
}
@SubscribeEvent
public void finishMakingCosmicStuffLessDumbInGUIs(GuiScreenEvent.DrawScreenEvent.Post event) {
CosmicRenderShenanigans.inventoryRender = false;
}
}
@@ -20,6 +20,8 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.gtnewhorizon.gtnhlib.client.renderer.postprocessing.shaders.UniversiumShader;
import fox.spiteful.avaritia.items.ItemArmorInfinity;
import fox.spiteful.avaritia.items.LudicrousItems;
@@ -175,14 +177,14 @@ public class ModelArmorInfinity extends ModelBiped {
super.render(entity, f, f1, f2, f3, f4, f5);
}
if (!CosmicRenderShenanigans.inventoryRender) {
if (!UniversiumShader.isRenderingInInventory()) {
mc.entityRenderer.enableLightmap(15.0);
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glColor4d(1, 1, 1, 1);
// WINGS
if (isFlying && !CosmicRenderShenanigans.inventoryRender) {
if (isFlying && !UniversiumShader.isRenderingInInventory()) {
this.setWings();
mc.renderEngine.bindTexture(wingTex);
super.render(entity, f, f1, f2, f3, f4, f5);
@@ -209,7 +211,7 @@ public class ModelArmorInfinity extends ModelBiped {
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
if (!CosmicRenderShenanigans.inventoryRender) {
if (!UniversiumShader.isRenderingInInventory()) {
mc.entityRenderer.enableLightmap(0.0);
}
GL11.glEnable(GL11.GL_LIGHTING);
@@ -1,6 +0,0 @@
package fox.spiteful.avaritia.render;
public abstract class ShaderCallback {
public abstract void call(int shader);
}
@@ -1,169 +0,0 @@
/**
* Original class written by Vazkii for Botania.
*/
// TEMA: this is the main shader stuff, where the programs are loaded and compiled for the card.
// other relevant files are the shader in /assets/physis/shader/, and the tesr in /client/render/tile/
// they have other comments like this in.
package fox.spiteful.avaritia.render;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import org.apache.logging.log4j.Level;
import org.lwjgl.opengl.ARBFragmentShader;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.ARBVertexShader;
import org.lwjgl.opengl.GL11;
import fox.spiteful.avaritia.Lumberjack;
public final class ShaderHelper {
private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB;
private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB;
private static final String PREFIX = "/assets/avaritia/shader/";
public static int cosmicShader = 0;
public static void initShaders() {
if (!useShaders()) return;
cosmicShader = createProgram("cosmic.vert", "cosmic.frag");
}
public static void useShader(int shader, ShaderCallback callback) {
if (!useShaders()) return;
ARBShaderObjects.glUseProgramObjectARB(shader);
if (shader != 0) {
int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time");
Minecraft mc = Minecraft.getMinecraft();
if (mc.thePlayer != null && mc.thePlayer.worldObj != null) {
ARBShaderObjects.glUniform1iARB(time, (int) (mc.thePlayer.worldObj.getWorldTime() % Integer.MAX_VALUE));
}
if (callback != null) callback.call(shader);
}
}
public static void useShader(int shader) {
useShader(shader, null);
}
public static void releaseShader() {
useShader(0);
}
public static boolean useShaders() {
return OpenGlHelper.shadersSupported;
}
// Most of the code taken from the LWJGL wiki
// http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
private static int createProgram(String vert, String frag) {
int vertId = 0, fragId = 0, program = 0;
if (vert != null) vertId = createShader(PREFIX + vert, VERT);
if (frag != null) fragId = createShader(PREFIX + frag, FRAG);
program = ARBShaderObjects.glCreateProgramObjectARB();
if (program == 0) return 0;
if (vert != null) ARBShaderObjects.glAttachObjectARB(program, vertId);
if (frag != null) ARBShaderObjects.glAttachObjectARB(program, fragId);
ARBShaderObjects.glLinkProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB)
== GL11.GL_FALSE) {
Lumberjack.log(Level.ERROR, getLogInfo(program));
return 0;
}
ARBShaderObjects.glValidateProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB)
== GL11.GL_FALSE) {
Lumberjack.log(Level.ERROR, getLogInfo(program));
return 0;
}
return program;
}
private static int createShader(String filename, int shaderType) {
int shader = 0;
try {
shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
if (shader == 0) return 0;
ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
ARBShaderObjects.glCompileShaderARB(shader);
if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB)
== GL11.GL_FALSE)
throw new RuntimeException("Error creating shader \"" + filename + "\": " + getLogInfo(shader));
return shader;
} catch (Exception e) {
ARBShaderObjects.glDeleteObjectARB(shader);
e.printStackTrace();
return -1;
}
}
private static String getLogInfo(int obj) {
return ARBShaderObjects.glGetInfoLogARB(
obj,
ARBShaderObjects.glGetObjectParameteriARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB));
}
private static String readFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
InputStream in = ShaderHelper.class.getResourceAsStream(filename);
Exception exception = null;
BufferedReader reader;
if (in == null) return "";
try {
reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
Exception innerExc = null;
try {
String line;
while ((line = reader.readLine()) != null) source.append(line).append('\n');
} catch (Exception exc) {
exception = exc;
} finally {
try {
reader.close();
} catch (Exception exc) {
if (innerExc == null) innerExc = exc;
else exc.printStackTrace();
}
}
if (innerExc != null) throw innerExc;
} catch (Exception exc) {
exception = exc;
} finally {
try {
in.close();
} catch (Exception exc) {
if (exception == null) exception = exc;
else exc.printStackTrace();
}
if (exception != null) throw exception;
}
return source.toString();
}
}
@@ -1,182 +0,0 @@
#version 120
#define M_PI 3.1415926535897932384626433832795
const int cosmiccount = 10;
const int cosmicoutof = 101;
uniform sampler2D texture0;
uniform vec3 lightlevel;
uniform float time2;
uniform float yaw;
uniform float pitch;
uniform float externalScale;
uniform float lightmix;
uniform float opacity;
uniform mat2 cosmicuvs[cosmiccount];
varying vec3 position;
float rand2d(vec2 x) {
return fract(sin(mod(dot(x, vec2(12.9898, 78.233)), 3.14)) * 43758.5453);
}
mat4 rotationMatrix(vec3 axis, float angle)
{
axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
0.0, 0.0, 0.0, 1.0);
}
void main (void)
{
vec4 light = gl_Color;
vec4 mask = texture2D(texture0, gl_TexCoord[0].xy);
light.rgb *= lightlevel;
float correctTime = mod(time2,12000);
float oneOverExternalScale = 1.0/externalScale;
int uvtiles = 16;
// background colour
vec4 col = vec4(0.1,0.0,0.0,1.0);
float pulse = mod(correctTime,400)/400.0;
col.g = sin(pulse*M_PI*2) * 0.075 + 0.225;
col.b = cos(pulse*M_PI*2) * 0.05 + 0.3;
// get ray from camera to fragment
vec4 dir = normalize(vec4( -position, 0));
// rotate the ray to show the right bit of the sphere for the angle
float sb = sin(pitch);
float cb = cos(pitch);
dir = normalize(vec4(dir.x, dir.y * cb - dir.z * sb, dir.y * sb + dir.z * cb, 0));
float sa = sin(-yaw);
float ca = cos(-yaw);
dir = normalize(vec4(dir.z * sa + dir.x * ca, dir.y, dir.z * ca - dir.x * sa, 0));
vec4 ray;
// draw the layers
for (int i=0; i<16; i++) {
int mult = 16-i;
// get semi-random stuff
int j = i + 7;
float rand1 = (j * j * 4321 + j * 8) * 2.0;
int k = j + 1;
float rand2 = (k * k * k * 239 + k * 37) * 3.6;
float rand3 = rand1 * 347.4 + rand2 * 63.4;
// random rotation matrix by random rotation around random axis
vec3 axis = normalize(vec3(sin(rand1), sin(rand2) , cos(rand3)));
// apply
ray = dir * rotationMatrix(axis, mod(rand3, 2*M_PI));
// calcuate the UVs from the final ray
float rawu = 0.5 + (atan(ray.z,ray.x)/(2*M_PI));
float rawv = 0.5 + (asin(ray.y)/M_PI);
// get UV scaled for layers and offset by time;
float scale = mult*0.5 + 2.75;
float u = rawu * scale * externalScale;
//float v = (rawv + time * 0.00006) * scale * 0.6;
float v = (rawv + correctTime * 0.0002 * oneOverExternalScale) * scale * 0.6 * externalScale;
vec2 tex = vec2( u, v );
// tile position of the current uv
int tu = int(mod(floor(u*uvtiles),uvtiles));
int tv = int(mod(floor(v*uvtiles),uvtiles));
// get pseudorandom variants
int symbol = int(rand2d(vec2(tu, tv + i * 10.0)) * cosmicoutof);
int rotation = int(mod(pow(tu,float(tv)) + tu + 3 + tv*i, 8));
bool flip = false;
if (rotation >= 4) {
rotation -= 4;
flip = true;
}
// if it's an icon, then add the colour!
if (symbol >= 0 && symbol < cosmiccount) {
vec2 cosmictex = vec2(1.0,1.0);
vec4 tcol = vec4(1.0,0.0,0.0,1.0);
// get uv within the tile
float ru = clamp(mod(u,1.0)*uvtiles - tu, 0.0, 1.0);
float rv = clamp(mod(v,1.0)*uvtiles - tv, 0.0, 1.0);
if (flip) {
ru = 1.0 - ru;
}
float oru = ru;
float orv = rv;
// rotate uvs if necessary
if (rotation == 1) {
oru = 1.0-rv;
orv = ru;
} else if (rotation == 2) {
oru = 1.0-ru;
orv = 1.0-rv;
} else if (rotation == 3) {
oru = rv;
orv = 1.0-ru;
}
// get the iicon uvs for the tile
float umin = cosmicuvs[symbol][0][0];
float umax = cosmicuvs[symbol][1][0];
float vmin = cosmicuvs[symbol][0][1];
float vmax = cosmicuvs[symbol][1][1];
// interpolate based on tile uvs
cosmictex.x = umin * (1.0-oru) + umax * oru;
cosmictex.y = vmin * (1.0-orv) + vmax * orv;
tcol = texture2D(texture0, cosmictex);
// set the alpha, blending out at the bunched ends
float a = tcol.r * (0.5 + (1.0/mult) * 1.0) * (1.0-smoothstep(0.15, 0.48, abs(rawv-0.5)));
// get fancy colours
float r = (mod(rand1, 29.0)/29.0) * 0.3 + 0.4;
float g = (mod(rand2, 35.0)/35.0) * 0.4 + 0.6;
float b = (mod(rand1, 17.0)/17.0) * 0.3 + 0.7;
// mix the colours
//col = col*(1-a) + vec4(r,g,b,1)*a;
col = col + vec4(r,g,b,1)*a;
}
}
// apply lighting
vec3 shade = light.rgb * (lightmix) + vec3(1.0-lightmix,1.0-lightmix,1.0-lightmix);
col.rgb *= shade;
// apply mask
col.a *= mask.a * opacity;
col = clamp(col,0.0,1.0);
gl_FragColor = col;
}
@@ -1,224 +0,0 @@
#version 120
vec4 Ambient;
vec4 Diffuse;
vec4 Specular;
attribute float activelights;
varying vec3 position;
void pointLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
float nDotVP; // normal . light direction
float nDotHV; // normal . light half vector
float pf; // power factor
float attenuation; // computed attenuation factor
float d; // distance from surface to light source
vec3 VP; // direction from surface to light position
vec3 halfVector; // direction of maximum highlights
// Compute vector from surface to light position
VP = vec3 (gl_LightSource[i].position) - ecPosition3;
// Compute distance between surface and light position
d = length(VP);
// Normalize the vector from surface to light position
VP = normalize(VP);
// Compute attenuation
attenuation = 1.0 / (gl_LightSource[i].constantAttenuation +
gl_LightSource[i].linearAttenuation * d +
gl_LightSource[i].quadraticAttenuation * d * d);
halfVector = normalize(VP + eye);
nDotVP = max(0.0, dot(normal, VP));
//nDotHV = max(0.0, dot(normal, halfVector));
//if (nDotVP == 0.0)
//{
pf = 0.0;
//}
//else
//{
// pf = pow(nDotHV, gl_FrontMaterial.shininess);
//}
Ambient += gl_LightSource[i].ambient * attenuation;
Diffuse += gl_LightSource[i].diffuse * nDotVP * attenuation;
//Specular += gl_LightSource[i].specular * pf * attenuation;
}
void spotLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
float nDotVP; // normal . light direction
float nDotHV; // normal . light half vector
float pf; // power factor
float spotDot; // cosine of angle between spotlight
float spotAttenuation; // spotlight attenuation factor
float attenuation; // computed attenuation factor
float d; // distance from surface to light source
vec3 VP; // direction from surface to light position
vec3 halfVector; // direction of maximum highlights
// Compute vector from surface to light position
VP = vec3 (gl_LightSource[i].position) - ecPosition3;
// Compute distance between surface and light position
d = length(VP);
// Normalize the vector from surface to light position
VP = normalize(VP);
// Compute attenuation
attenuation = 1.0 / (gl_LightSource[i].constantAttenuation +
gl_LightSource[i].linearAttenuation * d +
gl_LightSource[i].quadraticAttenuation * d * d);
// See if point on surface is inside cone of illumination
spotDot = dot(-VP, normalize(gl_LightSource[i].spotDirection));
if (spotDot < gl_LightSource[i].spotCosCutoff)
{
spotAttenuation = 0.0; // light adds no contribution
}
else
{
spotAttenuation = pow(spotDot, gl_LightSource[i].spotExponent);
}
// Combine the spotlight and distance attenuation.
attenuation *= spotAttenuation;
halfVector = normalize(VP + eye);
nDotVP = max(0.0, dot(normal, VP));
//nDotHV = max(0.0, dot(normal, halfVector));
//if (nDotVP == 0.0)
//{
pf = 0.0;
//}
//else
//{
// pf = pow(nDotHV, gl_FrontMaterial.shininess);
//
// }
Ambient += gl_LightSource[i].ambient * attenuation;
Diffuse += gl_LightSource[i].diffuse * nDotVP * attenuation;
//Specular += gl_LightSource[i].specular * pf * attenuation;
}
void directionalLight(in int i, in vec3 normal)
{
float nDotVP; // normal . light direction
float nDotHV; // normal . light half vector
float pf; // power factor
nDotVP = max(0.0, dot(normal, normalize(vec3 (gl_LightSource[i].position))));
//nDotHV = max(0.0, dot(normal, vec3 (gl_LightSource[i].halfVector)));
//if (nDotVP == 0.0)
//{
pf = 0.0;
//}
//else
//{
// pf = pow(nDotHV, gl_FrontMaterial.shininess);
//}
Ambient += gl_LightSource[i].ambient;
Diffuse += gl_LightSource[i].diffuse * nDotVP;
//Specular += gl_LightSource[i].specular * pf;
}
vec3 fnormal(void)
{
//Compute the normal
vec3 normal = gl_NormalMatrix * gl_Normal;
normal = normalize(normal);
return normal;
}
void ProcessLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
if (gl_LightSource[i].spotCutoff==180.0)
{
if (gl_LightSource[i].position.w==0.0)
{
directionalLight(i, normal);
}
else
{
pointLight(i, normal, eye, ecPosition3);
}
}
else
{
spotLight(i,normal,eye,ecPosition3);
}
}
void flight(in vec3 normal, in vec4 ecPosition, float alphaFade)
{
vec4 color;
vec3 ecPosition3;
vec3 eye;
int i;
ecPosition3 = (vec3 (ecPosition)) / ecPosition.w;
eye = vec3 (0.0, 0.0, 1.0);
// Clear the light intensity accumulators
Ambient = vec4 (0.0);
Diffuse = vec4 (0.0);
Specular = vec4 (0.0);
if (activelights>0)
{
ProcessLight(0,normal,eye,ecPosition3);
}
if (activelights>1)
{
ProcessLight(1,normal,eye,ecPosition3);
}
//if (activelights>2)
//{
// ProcessLight(2,normal,eye,ecPosition3);
//}
//if (activelights>3)
//{
// ProcessLight(3,normal,eye,ecPosition3);
//}
color = gl_FrontLightModelProduct.sceneColor +
Ambient * gl_FrontMaterial.ambient +
Diffuse * gl_FrontMaterial.diffuse;
color += Specular * gl_FrontMaterial.specular;
color = clamp( color, 0.0, 1.0 );
gl_FrontColor = color;
gl_FrontColor.a *= alphaFade;
}
void main (void)
{
vec3 transformedNormal;
float alphaFade = 1.0;
// Eye-coordinate position of vertex, needed in various calculations
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
// Do fixed functionality vertex transform
gl_Position = ftransform();
transformedNormal = fnormal();
flight(transformedNormal, ecPosition, alphaFade);
//Enable texture coordinates
gl_TexCoord[0] = gl_MultiTexCoord0;
//gl_TexCoord[1] = gl_MultiTexCoord1;
//gl_TexCoord[2] = gl_MultiTexCoord2;
//gl_TexCoord[3] = gl_MultiTexCoord3;
position = (gl_ModelViewMatrix * gl_Vertex).xyz;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

@@ -1,14 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
{
"index": 0,
"time": 7
},
1,
2,
3
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

@@ -1,22 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
{
"index": 0,
"time": 4
},
1,
{
"index": 0,
"time": 9
},
2,
{
"index": 0,
"time": 7
},
3
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

@@ -1,26 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
{
"index": 0,
"time": 16
},
1,
1,
1,
2,
2,
3,
4,
3,
4,
3,
2,
2,
1,
1,
1
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

@@ -1,27 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
{
"index": 0,
"time": 13
},
1,
{
"index": 0,
"time": 10
},
3,
{
"index": 0,
"time": 5
},
2,
{
"index": 0,
"time": 15
},
4
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

@@ -1,14 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
{
"index": 0,
"time": 34
},
1,
2,
3
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

@@ -1,23 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
{
"index": 0,
"time": 18
},
1,
{
"index": 0,
"time": 4
},
3,
{
"index": 0,
"time": 14
},
2
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

@@ -1,5 +0,0 @@
{
"animation": {
"frametime": 1
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

@@ -1,5 +0,0 @@
{
"animation": {
"frametime": 2
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

@@ -1,38 +0,0 @@
{
"animation": {
"frametime": 1,
"frames": [
1,
2,
3,
2,
3,
2,
1,
{
"index": 0,
"time": 22
},
4,
5,
6,
5,
6,
5,
4,
{
"index": 0,
"time": 31
},
1,
2,
3,
2,
1,
{
"index": 0,
"time": 12
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 603 B

@@ -1,5 +0,0 @@
{
"animation": {
"frametime": 2
}
}