Sounds, block outlines, and fixed rendering BS

This commit is contained in:
peytonplayz585 2023-07-25 22:12:48 -07:00
parent 475ced969c
commit 4f9570d239
47 changed files with 2853 additions and 2641 deletions

5263
js/app.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -32,9 +32,6 @@ out vec4 v_position;
#ifdef CC_a_color
out vec4 v_color;
#endif
#ifdef CC_a_normal
out vec4 v_normal;
#endif
#ifdef CC_a_texture0
out vec2 v_texture0;
#endif
@ -47,9 +44,6 @@ void main(){
#ifdef CC_a_color
v_color = a_color;
#endif
#ifdef CC_a_normal
v_normal = a_normal;
#endif
#ifdef CC_a_texture0
v_texture0 = a_texture0;
#endif

BIN
resources/music/calm1.mp3 Normal file

Binary file not shown.

BIN
resources/music/calm2.mp3 Normal file

Binary file not shown.

BIN
resources/music/calm3.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -491,7 +491,7 @@ public final class Minecraft implements Runnable {
if((var104 = var89.level.getTile(var122, var125, var38)) != 0 && Block.blocks[var104].isSolid()) {
GL11.glColor4f(0.2F, 0.2F, 0.2F, 1.0F);
GL11.glDepthFunc(513);
tessellator.startDrawing();
tessellator.startDrawing(7);
for(var114 = 0; var114 < 6; ++var114) {
Block.blocks[var104].renderInside(var99, var98, var105, var114);
@ -499,7 +499,7 @@ public final class Minecraft implements Runnable {
tessellator.draw();
GL11.glCullFace(1028);
tessellator.startDrawing();
tessellator.startDrawing(7);
for(var114 = 0; var114 < 6; ++var114) {
Block.blocks[var104].renderInside(var99, var98, var105, var114);
@ -537,7 +537,7 @@ public final class Minecraft implements Runnable {
var110 = new TextureLocation("/terrain.png").bindTexture();
}
tessellator.startDrawing();
tessellator.startDrawing(7);
for(var120 = 0; var120 < var96.particles[var83].size(); ++var120) {
((Particle)var96.particles[var83].get(var120)).render(var107, var29, var69, var30, var117, var32);
@ -571,7 +571,7 @@ public final class Minecraft implements Runnable {
var74 = (float)(var89.level.depth + 2);
var34 = ((float)var89.ticks + var80) * var33 * 0.03F;
var35 = 0.0F;
tessellator.startDrawing();
tessellator.startDrawing(7);
tessellator.setColorOpaque_F(var107, var29, var30);
for(var86 = -2048; var86 < var101.level.width + 2048; var86 += 512) {
@ -589,7 +589,7 @@ public final class Minecraft implements Runnable {
tessellator.draw();
GL11.glDisable(3553);
tessellator.startDrawing();
tessellator.startDrawing(7);
var34 = (float)(var101.level.skyColor >> 16 & 255) / 255.0F;
var35 = (float)(var101.level.skyColor >> 8 & 255) / 255.0F;
var87 = (float)(var101.level.skyColor & 255) / 255.0F;
@ -643,7 +643,7 @@ public final class Minecraft implements Runnable {
var35 = 1.01F;
GL11.glScalef(1.01F, var35, var35);
GL11.glTranslatef(-((float)var102.x + var74), -((float)var102.y + var33), -((float)var102.z + var34));
tessellator.startDrawing();
tessellator.startDrawing(7);
tessellator.disableColor();
GL11.glDepthMask(false);
if(var73 == null) {
@ -672,6 +672,33 @@ public final class Minecraft implements Runnable {
GL11.glDisable(3553);
GL11.glDepthMask(false);
var29 = 0.002F;
if((var104 = var89.level.getTile(var102.x, var102.y, var102.z)) > 0) {
AABB var111 = Block.blocks[var104].getSelectionBox(var102.x, var102.y, var102.z).grow(var29, var29, var29);
tessellator.startDrawing(3);
tessellator.addVertex(var111.x0, var111.y0, var111.z0);
tessellator.addVertex(var111.x1, var111.y0, var111.z0);
tessellator.addVertex(var111.x1, var111.y0, var111.z1);
tessellator.addVertex(var111.x0, var111.y0, var111.z1);
tessellator.addVertex(var111.x0, var111.y0, var111.z0);
tessellator.draw();
tessellator.startDrawing(3);
tessellator.addVertex(var111.x0, var111.y1, var111.z0);
tessellator.addVertex(var111.x1, var111.y1, var111.z0);
tessellator.addVertex(var111.x1, var111.y1, var111.z1);
tessellator.addVertex(var111.x0, var111.y1, var111.z1);
tessellator.addVertex(var111.x0, var111.y1, var111.z0);
tessellator.draw();
tessellator.startDrawing(1);
tessellator.addVertex(var111.x0, var111.y0, var111.z0);
tessellator.addVertex(var111.x0, var111.y1, var111.z0);
tessellator.addVertex(var111.x1, var111.y0, var111.z0);
tessellator.addVertex(var111.x1, var111.y1, var111.z0);
tessellator.addVertex(var111.x1, var111.y0, var111.z1);
tessellator.addVertex(var111.x1, var111.y1, var111.z1);
tessellator.addVertex(var111.x0, var111.y0, var111.z1);
tessellator.addVertex(var111.x0, var111.y1, var111.z1);
tessellator.draw();
}
GL11.glDepthMask(true);
GL11.glEnable(3553);
GL11.glDisable(3042);
@ -738,7 +765,7 @@ public final class Minecraft implements Runnable {
var35 = (float)var122 + 0.5F - var28.z;
float var92 = MathHelper.sqrt(var124 * var124 + var35 * var35) / (float)5;
GL11.glColor4f(1.0F, 1.0F, 1.0F, (1.0F - var92 * var92) * 0.7F);
tessellator.startDrawing();
tessellator.startDrawing(7);
tessellator.addVertexWithUV((float)var110, (float)var86, (float)var122, 0.0F, (float)var86 * 2.0F / 8.0F + var74 * 2.0F);
tessellator.addVertexWithUV((float)(var110 + 1), (float)var86, (float)(var122 + 1), 2.0F, (float)var86 * 2.0F / 8.0F + var74 * 2.0F);
tessellator.addVertexWithUV((float)(var110 + 1), (float)var125, (float)(var122 + 1), 2.0F, (float)var125 * 2.0F / 8.0F + var74 * 2.0F);

View File

@ -59,7 +59,7 @@ public final class ProgressBarDisplay {
Tessellator tessellator = Tessellator.instance;
int var7 = new TextureLocation("/dirt.png").bindTexture();
float var10 = 32.0F;
tessellator.startDrawing();
tessellator.startDrawing(7);
tessellator.setColorOpaque_I(4210752);
tessellator.addVertexWithUV(0.0F, (float)var5, 0.0F, 0.0F, (float)var5 / var10);
tessellator.addVertexWithUV((float)var4, (float)var5, 0.0F, (float)var4 / var10, (float)var5 / var10);
@ -70,7 +70,7 @@ public final class ProgressBarDisplay {
var7 = var4 / 2 - 50;
int var8 = var5 / 2 + 16;
GL11.glDisable(3553);
tessellator.startDrawing();
tessellator.startDrawing(7);
tessellator.setColorOpaque_I(8421504);
tessellator.addVertex((float)var7, (float)var8, 0.0F);
tessellator.addVertex((float)var7, (float)(var8 + 2), 0.0F);

View File

@ -1,5 +1,9 @@
package com.mojang.minecraft.gamemode;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.mojang.minecraft.Minecraft;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.Block;
@ -46,6 +50,11 @@ public class GameMode
boolean success = level.netSetTile(x, y, z, 0);
if(block.stepsound != Tile$SoundType.none && minecraft.settings.sound)
{
level.playSound(block.stepsound.name, (float)x, (float)y, (float)z, (block.stepsound.getVolume() + 1.0F) / 2.0F,block.stepsound.getPitch());
}
if(block != null && success)
{
block.spawnBreakParticles(level, x, y, z, minecraft.particleManager);

View File

@ -56,7 +56,7 @@ public final class BlockSelectScreen extends GuiScreen {
GL11.glTranslatef(-1.5F, 0.5F, 0.5F);
GL11.glScalef(-1.0F, -1.0F, -1.0F);
tessellator.startDrawing();
tessellator.startDrawing(7);
var4.renderFullbright();
tessellator.draw();
GL11.glPopMatrix();

View File

@ -56,7 +56,7 @@ public class FontRenderer {
Tessellator tessellator = Tessellator.instance;
for (int i1 = 0; i1 < 256; i1++) {
GL11.glNewList(fontDisplayLists + i1, 4864 /* GL_COMPILE */);
tessellator.startDrawingQuads();
tessellator.startDrawing(7);
int l1 = (i1 % 16) * 8;
int k2 = (i1 / 16) * 8;
float f = 7.99F;

View File

@ -135,7 +135,7 @@ public final class HUDScreen extends Screen {
GL11.glTranslatef(-1.5F, 0.5F, 0.5F);
GL11.glScalef(-1.0F, -1.0F, -1.0F);
new TextureLocation("/terrain.png").bindTexture();
tessellator.startDrawing();
tessellator.startDrawing(7);
Block.blocks[var15].renderFullbright();
tessellator.draw();
GL11.glPopMatrix();

View File

@ -21,7 +21,7 @@ public class Screen {
GL11.glDisable(3553);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(var6, var7, var9, var5);
tessellator.startDrawing();
tessellator.startDrawing(7);
tessellator.addVertex((float)var0, (float)var3, 0.0F);
tessellator.addVertex((float)var2, (float)var3, 0.0F);
tessellator.addVertex((float)var2, (float)var1, 0.0F);
@ -46,7 +46,7 @@ public class Screen {
GL11.glBlendFunc(770, 771);
GL11.glShadeModel(7425 /* GL_SMOOTH */);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.startDrawing(7);
tessellator.setColorRGBA_F(f1, f2, f3, f);
tessellator.addVertex(k, j, 0.0D);
tessellator.addVertex(i, j, 0.0D);
@ -73,7 +73,7 @@ public class Screen {
float var7 = 0.00390625F;
float var8 = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawing();
tessellator.startDrawing(7);
tessellator.addVertexWithUV((float)var1, (float)(var2 + var6), this.imgZ, (float)var3 * var7, (float)(var4 + var6) * var8);
tessellator.addVertexWithUV((float)(var1 + var5), (float)(var2 + var6), this.imgZ, (float)(var3 + var5) * var7, (float)(var4 + var6) * var8);
tessellator.addVertexWithUV((float)(var1 + var5), (float)var2, this.imgZ, (float)(var3 + var5) * var7, (float)var4 * var8);

View File

@ -201,14 +201,14 @@ public class Arrow extends Entity
GL11.glEnable(GL11.GL_RESCALE_NORMAL);
GL11.glScalef(0.05625F, var20, var20);
GL11.glNormal3f(var20, 0.0F, 0.0F);
var10.startDrawingQuads();
var10.startDrawing(7);
var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) var16, (double) var18);
var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) var17, (double) var18);
var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) var17, (double) var19);
var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) var16, (double) var19);
var10.draw();
GL11.glNormal3f(-var20, 0.0F, 0.0F);
var10.startDrawingQuads();
var10.startDrawing(7);
var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) var16, (double) var18);
var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) var17, (double) var18);
var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) var17, (double) var19);
@ -218,7 +218,7 @@ public class Arrow extends Entity
for (int var23 = 0; var23 < 4; ++var23) {
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, -var20);
var10.startDrawingQuads();
var10.startDrawing(7);
var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) var12, (double) var14);
var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) var13, (double) var14);
var10.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) var13, (double) var15);

View File

@ -18,6 +18,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.Random;
import org.lwjgl.opengl.GL11;
public class Level implements Serializable {
public static final long serialVersionUID = 0L;
@ -977,4 +979,30 @@ public class Level implements Serializable {
public void removeAllNonCreativeModeEntities() {
this.blockMap.removeAllNonCreativeModeEntities();
}
public void playSound(String name, float x, float y, float z, float f, float g) {
if(name == "grass" || name == "cloth") {
Random rand = new Random();
int randNum = rand.nextInt((4 - 1) + 1) + 1;
if(randNum == 3) {
randNum = rand.nextInt((4 - 1) + 1) + 1;
}
if(randNum == 3) {
randNum = rand.nextInt((4 - 1) + 1) + 1;
}
GL11.beginPlayback("sounds/blocks/grass" + randNum + ".mp3");
} else if(name == "wood") {
Random rand = new Random();
int randNum = rand.nextInt((4 - 1) + 1) + 1;
GL11.beginPlayback("sounds/blocks/wood" + randNum + ".mp3");
} else if(name == "gravel") {
Random rand = new Random();
int randNum = rand.nextInt((4 - 1) + 1) + 1;
GL11.beginPlayback("sounds/blocks/gravel" + randNum + ".mp3");
} else if(name == "metal" || name == "stone") {
Random rand = new Random();
int randNum = rand.nextInt((4 - 1) + 1) + 1;
GL11.beginPlayback("sounds/blocks/stone" + randNum + ".mp3");
}
}
}

View File

@ -446,7 +446,7 @@ public class Block
public void renderPreview() {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawing();
tessellator.startDrawing(7);
for(int var2 = 0; var2 < 6; ++var2) {
if(var2 == 0) {
@ -704,10 +704,10 @@ public class Block
BLACK_WOOL = (new Block(34, 77)).setData(Tile$SoundType.cloth, 1.0F, 1.0F, 0.8F);
GRAY_WOOL = (new Block(35, 78)).setData(Tile$SoundType.cloth, 1.0F, 1.0F, 0.8F);
WHITE_WOOL = (new Block(36, 79)).setData(Tile$SoundType.cloth, 1.0F, 1.0F, 0.8F);
DANDELION = (new FlowerBlock(37, 13)).setData(Tile$SoundType.none, 0.7F, 1.0F, 0.0F);
ROSE = (new FlowerBlock(38, 12)).setData(Tile$SoundType.none, 0.7F, 1.0F, 0.0F);
BROWN_MUSHROOM = (new MushroomBlock(39, 29)).setData(Tile$SoundType.none, 0.7F, 1.0F, 0.0F);
RED_MUSHROOM = (new MushroomBlock(40, 28)).setData(Tile$SoundType.none, 0.7F, 1.0F, 0.0F);
DANDELION = (new FlowerBlock(37, 13)).setData(Tile$SoundType.grass, 0.7F, 1.0F, 0.0F);
ROSE = (new FlowerBlock(38, 12)).setData(Tile$SoundType.grass, 0.7F, 1.0F, 0.0F);
BROWN_MUSHROOM = (new MushroomBlock(39, 29)).setData(Tile$SoundType.grass, 0.7F, 1.0F, 0.0F);
RED_MUSHROOM = (new MushroomBlock(40, 28)).setData(Tile$SoundType.grass, 0.7F, 1.0F, 0.0F);
var10000 = (new MetalBlock(41, 40)).setData(Tile$SoundType.metal, 0.7F, 1.0F, 3.0F);
var0 = false;
var1 = var10000;

View File

@ -68,7 +68,7 @@ public class FlowerBlock extends Block {
public final void renderPreview() {
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.startDrawing();
tessellator.startDrawing(7);
this.render(0.0F, 0.4F, -0.3F);
tessellator.draw();
}

View File

@ -155,10 +155,6 @@ public class LiquidBlock extends Block {
return 0;
}
public final int getRenderPass() {
return 0;
}
@Override
public AABB getCollisionBox(int x, int y, int z)
{

View File

@ -1,10 +1,12 @@
package com.mojang.minecraft.mob;
import com.mojang.minecraft.Entity;
import com.mojang.minecraft.Minecraft;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.mob.ai.AI;
import com.mojang.minecraft.mob.ai.BasicAI;
import com.mojang.minecraft.model.ModelManager;
import com.mojang.minecraft.player.Player;
import com.mojang.minecraft.render.RenderEngine;
import com.mojang.minecraft.render.TextureLocation;
@ -70,8 +72,15 @@ public class Mob extends Entity {
return !this.removed;
}
private int prevHealth = this.health;
public final void tick() {
super.tick();
if(this instanceof Player) {
if(this.health < this.prevHealth && Minecraft.settings.sound) {
GL11.beginPlayback("sounds/player/oof.mp3");
}
}
this.prevHealth = this.health;
this.oTilt = this.tilt;
if(this.attackTime > 0) {
--this.attackTime;

View File

@ -97,7 +97,7 @@ public final class ModelPart {
Tessellator var4 = Tessellator.instance;
for(int var5 = 0; var5 < var2.quads.length; ++var5) {
var4.startDrawingQuads();
var4.startDrawing(7);
TexturedQuad var10000 = var2.quads[var5];
float var8 = var3;
TexturedQuad var6 = var10000;

View File

@ -54,7 +54,7 @@ public final class Chunk {
boolean var8 = false;
boolean var9 = false;
GL11.glNewList(this.baseListId + var7, 4864);
renderer.startDrawing();
renderer.startDrawing(7);
for(int var10 = var1; var10 < var4; ++var10) {
for(int var11 = var2; var11 < var5; ++var11) {

View File

@ -23,9 +23,9 @@ public class ChunkDistanceComparator implements Comparator
{
return 0;
} else if(sqDist > otherSqDist) {
return -1;
} else {
return 1;
} else {
return -1;
}
}

View File

@ -88,7 +88,7 @@ public final class LevelRenderer {
}
int var6 = 2048 / var5;
var11.startDrawing();
var11.startDrawing(7);
int var7;
for(var7 = -var5 * var6; var7 < var9.level.width + var5 * var6; var7 += var5) {
@ -107,7 +107,7 @@ public final class LevelRenderer {
var11.draw();
GL11.glColor3f(0.8F, 0.8F, 0.8F);
var11.startDrawing();
var11.startDrawing(7);
for(var7 = 0; var7 < var9.level.width; var7 += var5) {
var11.addVertexWithUV((float)var7, 0.0F, 0.0F, 0.0F, 0.0F);
@ -151,7 +151,7 @@ public final class LevelRenderer {
}
var5 = 2048 / var4;
var11.startDrawing();
var11.startDrawing(7);
for(var6 = -var4 * var5; var6 < var9.level.width + var4 * var5; var6 += var4) {
for(var7 = -var4 * var5; var7 < var9.level.height + var4 * var5; var7 += var4) {

View File

@ -19,7 +19,7 @@ public class FixedFunctionShader {
}
public static final int COLOR = 1;
public static final int NORMAL = 2;
//public static final int NORMAL = 2;
public static final int TEXTURE0 = 4;
public static final int LIGHTING = 8;
public static final int FOG = 16;
@ -39,9 +39,9 @@ public class FixedFunctionShader {
if ((i & COLOR) == COLOR) {
CC_a_color = true;
}
if ((i & NORMAL) == NORMAL) {
CC_a_normal = true;
}
// if ((i & NORMAL) == NORMAL) {
// CC_a_normal = true;
// }
if ((i & TEXTURE0) == TEXTURE0) {
CC_a_texture0 = true;
}

View File

@ -4,6 +4,8 @@ import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.mojang.minecraft.Minecraft;
public class MusicThread {
static int currentSong = 0;
@ -11,6 +13,12 @@ public class MusicThread {
static boolean justfinishedPlayingSong = false;
public static void musicTick() {
if(!Minecraft.getMinecraft().settings.music) {
if(GL11.isPlaying(currentSong)) {
GL11.endSound(currentSong);
}
return;
}
if(!GL11.isPlaying(currentSong)) {
Random rand = new Random();
int randomNum = rand.nextInt((3 - 1) + 1) + 1;
@ -20,11 +28,11 @@ public class MusicThread {
lastSongPlayed = randomNum;
if(randomNum == 1) {
currentSong = GL11.beginPlayback("/music/calm1.mp3", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
currentSong = GL11.beginPlayback("/music/calm1.mp3", 1.0f, 1.0f, 1.0f, 0.3F);
} else if(randomNum == 2) {
currentSong = GL11.beginPlayback("/music/calm2.mp3", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
currentSong = GL11.beginPlayback("/music/calm2.mp3", 1.0f, 1.0f, 1.0f, 0.3F);
} else if(randomNum == 3) {
currentSong = GL11.beginPlayback("/music/calm3.mp3", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
currentSong = GL11.beginPlayback("/music/calm3.mp3", 1.0f, 1.0f, 1.0f, 0.3F);
} else {
throw new IndexOutOfBoundsException("Tried to play a sound that does not exist! :(");
}

View File

@ -1205,14 +1205,14 @@ public class EaglerAdapterImpl2 {
NONE, FAILED, BLOCKED, FAILED_POSSIBLY_LOCKED, LOCKED, NOW_LOCKED;
}
private static final Set<String> rateLimitedAddresses = new HashSet();
private static final Set<String> blockedAddresses = new HashSet();
private static final Set<String> rateLimitedAddresses = new HashSet<String>();
private static final Set<String> blockedAddresses = new HashSet<String>();
private static WebSocket sock = null;
private static boolean sockIsConnecting = false;
private static boolean sockIsConnected = false;
private static boolean sockIsAlive = false;
private static LinkedList<byte[]> readPackets = new LinkedList();
private static LinkedList<byte[]> readPackets = new LinkedList<byte[]>();
private static RateLimit rateLimitStatus = null;
private static String currentSockURI = null;
@ -1467,12 +1467,26 @@ public class EaglerAdapterImpl2 {
return ret.buffer;
}
public static final int beginPlayback(String fileName, float x, float y, float z, float volume, float pitch) {
public static void beginPlayback(String fileName) {
AudioBuffer b = getBufferFor(fileName);
if(b == null) return;
AudioBufferSourceNode s = audioctx.createBufferSource();
s.setBuffer(b);
PannerNode p = audioctx.createPanner();
GainNode g = audioctx.createGain();
g.getGain().setValue(1.0f);
s.connect(g);
g.connect(p);
p.connect(audioctx.getDestination());
s.start(0.0d, playbackOffsetDelay);
}
public static final int beginPlayback(String fileName, float x, float y, float z, float volume) {
AudioBuffer b = getBufferFor(fileName);
if(b == null) return -1;
AudioBufferSourceNode s = audioctx.createBufferSource();
s.setBuffer(b);
s.getPlaybackRate().setValue(pitch);
//s.getPlaybackRate().setValue(pitch);
PannerNode p = audioctx.createPanner();
p.setPosition(x, y, z);
p.setMaxDistance(volume * 16f + 0.1f);

View File

@ -84,6 +84,8 @@ public class Tessellator {
/** The size of the buffers used (in integers). */
private int bufferSize;
private int drawMode;
private Tessellator(int par1) {
this.bufferSize = par1;
ArrayBuffer a = ArrayBuffer.create(par1 * 4);
@ -115,7 +117,7 @@ public class Tessellator {
// GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
// }
GL11.glDrawArrays(7, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 7));
GL11.glDrawArrays(drawMode, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 7));
if (this.hasTexture) {
GL11.glDisableVertexAttrib(GL11.GL_TEXTURE_COORD_ARRAY);
@ -146,21 +148,15 @@ public class Tessellator {
this.addedVertices = 0;
}
/**
* Sets draw mode in the tessellator to draw quads.
*/
public void startDrawingQuads() {
this.startDrawing();
}
/**
* Resets tessellator state and prepares for drawing (with the specified draw
* mode).
*/
public void startDrawing() {
public void startDrawing(int drawMode) {
// if (this.isDrawing) {
// this.draw();
// }
this.drawMode = drawMode;
this.isDrawing = true;
this.reset();
this.hasNormals = false;

View File

@ -120,7 +120,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static DisplayList compilingDisplayList = null;
private static boolean enableColorArray = false;
private static boolean enableNormalArray = false;
//private static boolean enableNormalArray = false;
private static boolean enableTex0Array = false;
private static float colorR = 1.0f;
@ -745,9 +745,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
case GL_COLOR_ARRAY:
enableColorArray = true;
break;
case GL_NORMAL_ARRAY:
enableNormalArray = true;
break;
// case GL_NORMAL_ARRAY:
// enableNormalArray = true;
// break;
case GL_TEXTURE_COORD_ARRAY:
enableTex0Array = true;
break;
@ -761,9 +761,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
case GL_COLOR_ARRAY:
enableColorArray = false;
break;
case GL_NORMAL_ARRAY:
enableNormalArray = false;
break;
// case GL_NORMAL_ARRAY:
// enableNormalArray = false;
// break;
case GL_TEXTURE_COORD_ARRAY:
enableTex0Array = false;
break;
@ -775,7 +775,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static final int getShaderModeFlag0() {
int mode = 0;
mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 0));
mode = (mode | (enableNormalArray ? FixedFunctionShader.NORMAL : 0));
//mode = (mode | (enableNormalArray ? FixedFunctionShader.NORMAL : 0));
mode = (mode | (enableTex0Array ? FixedFunctionShader.TEXTURE0 : 0));
return mode;
}
@ -792,7 +792,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static final int getShaderModeFlag() {
int mode = 0;
mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 0));
mode = (mode | (enableNormalArray ? FixedFunctionShader.NORMAL : 0));
//mode = (mode | (enableNormalArray ? FixedFunctionShader.NORMAL : 0));
mode = (mode | (enableTex0Array ? FixedFunctionShader.TEXTURE0 : 0));
mode = (mode | ((enableColorMaterial && enableLighting) ? FixedFunctionShader.LIGHTING : 0));
mode = (mode | (fogEnabled ? FixedFunctionShader.FOG : 0));