Added step sounds and fix lighting
This commit is contained in:
parent
1a498516da
commit
665a385aab
File diff suppressed because one or more lines are too long
|
@ -1,12 +1,12 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Shadow Client Classic</title>
|
<title>0.30 Classic</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||||
<script type="text/javascript" charset="utf-8" src="app.js"></script>
|
<script type="text/javascript" charset="utf-8" src="app.js"></script>
|
||||||
<script type = text/javascript>
|
<script type = text/javascript>
|
||||||
if(document.location.href.startsWith("file:")) {
|
if(document.location.href.startsWith("file:")) {
|
||||||
alert("Offline Download is not yet supported, please upload all the game files to a HTTP(s) server");
|
alert("Offline Download is not supported yet, please upload all the game files to a HTTP(s) server");
|
||||||
} else {
|
} else {
|
||||||
window.addEventListener("load", function() {
|
window.addEventListener("load", function() {
|
||||||
window.classicConfig = ["game","resources.mc"];
|
window.classicConfig = ["game","resources.mc"];
|
||||||
|
|
BIN
js/resources.mc
BIN
js/resources.mc
Binary file not shown.
|
@ -32,6 +32,9 @@ out vec4 v_position;
|
||||||
#ifdef CC_a_color
|
#ifdef CC_a_color
|
||||||
out vec4 v_color;
|
out vec4 v_color;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CC_a_normal
|
||||||
|
out vec4 v_normal;
|
||||||
|
#endif
|
||||||
#ifdef CC_a_texture0
|
#ifdef CC_a_texture0
|
||||||
out vec2 v_texture0;
|
out vec2 v_texture0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,6 +47,9 @@ void main(){
|
||||||
#ifdef CC_a_color
|
#ifdef CC_a_color
|
||||||
v_color = a_color;
|
v_color = a_color;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CC_a_normal
|
||||||
|
v_normal = a_normal;
|
||||||
|
#endif
|
||||||
#ifdef CC_a_texture0
|
#ifdef CC_a_texture0
|
||||||
v_texture0 = a_texture0;
|
v_texture0 = a_texture0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class GameMode
|
||||||
|
|
||||||
if(block.stepsound != Tile$SoundType.none && minecraft.settings.sound)
|
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());
|
level.playSound(block.stepsound.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block != null && success)
|
if(block != null && success)
|
||||||
|
|
|
@ -146,9 +146,12 @@ public final class HUDScreen extends Screen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var5.drawString("0.30 WebGL", 2, 2, 16777215);
|
byte[] text = new byte[] {48, 46, 51, 48, 32, 67, 108, 97, 115, 115, 105, 99};
|
||||||
|
byte[] text1 = new byte[] {40, 77, 97, 100, 101, 32, 98, 121, 32, 80, 101, 121, 116, 111, 110, 80, 108, 97, 121, 122, 53, 56, 53, 41};
|
||||||
|
var5.drawString(new String(text), 2, 2, 16777215);
|
||||||
|
var5.drawString(new String(text1), 2, 12, 16777215);
|
||||||
if(this.mc.settings.showFrameRate) {
|
if(this.mc.settings.showFrameRate) {
|
||||||
var5.drawString(this.mc.debug, 2, 12, 16777215);
|
var5.drawString(this.mc.debug, 2, 22, 16777215);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.mc.gamemode instanceof SurvivalGameMode) {
|
if(this.mc.gamemode instanceof SurvivalGameMode) {
|
||||||
|
|
|
@ -980,7 +980,7 @@ public class Level implements Serializable {
|
||||||
this.blockMap.removeAllNonCreativeModeEntities();
|
this.blockMap.removeAllNonCreativeModeEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(String name, float x, float y, float z, float f, float g) {
|
public void playSound(String name) {
|
||||||
if(name == "grass" || name == "cloth") {
|
if(name == "grass" || name == "cloth") {
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
int randNum = rand.nextInt((4 - 1) + 1) + 1;
|
int randNum = rand.nextInt((4 - 1) + 1) + 1;
|
||||||
|
@ -1005,4 +1005,30 @@ public class Level implements Serializable {
|
||||||
GL11.beginPlayback("sounds/blocks/stone" + randNum + ".mp3");
|
GL11.beginPlayback("sounds/blocks/stone" + randNum + ".mp3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void playSound(String name, float volume) {
|
||||||
|
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", volume);
|
||||||
|
} else if(name == "wood") {
|
||||||
|
Random rand = new Random();
|
||||||
|
int randNum = rand.nextInt((4 - 1) + 1) + 1;
|
||||||
|
GL11.beginPlayback("sounds/blocks/wood" + randNum + ".mp3", 1.0F);
|
||||||
|
} else if(name == "gravel") {
|
||||||
|
Random rand = new Random();
|
||||||
|
int randNum = rand.nextInt((4 - 1) + 1) + 1;
|
||||||
|
GL11.beginPlayback("sounds/blocks/gravel" + randNum + ".mp3", volume);
|
||||||
|
} 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", 1.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.mojang.minecraft.mob;
|
||||||
import com.mojang.minecraft.Entity;
|
import com.mojang.minecraft.Entity;
|
||||||
import com.mojang.minecraft.Minecraft;
|
import com.mojang.minecraft.Minecraft;
|
||||||
import com.mojang.minecraft.level.Level;
|
import com.mojang.minecraft.level.Level;
|
||||||
|
import com.mojang.minecraft.level.tile.Block;
|
||||||
import com.mojang.minecraft.mob.ai.AI;
|
import com.mojang.minecraft.mob.ai.AI;
|
||||||
import com.mojang.minecraft.mob.ai.BasicAI;
|
import com.mojang.minecraft.mob.ai.BasicAI;
|
||||||
import com.mojang.minecraft.model.ModelManager;
|
import com.mojang.minecraft.model.ModelManager;
|
||||||
|
@ -73,12 +74,28 @@ public class Mob extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int prevHealth = this.health;
|
private int prevHealth = this.health;
|
||||||
|
private int prevX = (int)this.x;
|
||||||
|
private int prevZ = (int)this.z;
|
||||||
|
private int ticks = 0;
|
||||||
|
private int prevSoundPlayed = 0;
|
||||||
|
|
||||||
public final void tick() {
|
public final void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
ticks++;
|
||||||
if(this instanceof Player) {
|
if(this instanceof Player) {
|
||||||
if(this.health < this.prevHealth && Minecraft.settings.sound) {
|
if(this.health < this.prevHealth && Minecraft.settings.sound) {
|
||||||
GL11.beginPlayback("sounds/player/oof.mp3");
|
GL11.beginPlayback("sounds/player/oof.mp3");
|
||||||
}
|
}
|
||||||
|
if((prevX != (int)this.x || prevZ != (int)this.z) && this.onGround && ticks > (prevSoundPlayed + 8) && (!this.isInWater() || !this.isUnderWater())) {
|
||||||
|
int var19 = this.level.getTile((int)this.x, (int)(this.y - 0.2F - this.heightOffset), (int)this.z);
|
||||||
|
Block block = Block.blocks[var19];
|
||||||
|
if(block != null) {
|
||||||
|
Minecraft.getMinecraft().level.playSound(block.stepsound.name, 0.1F);
|
||||||
|
prevSoundPlayed = ticks;
|
||||||
|
}
|
||||||
|
prevX = (int)this.x;
|
||||||
|
prevZ = (int)this.z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.prevHealth = this.health;
|
this.prevHealth = this.health;
|
||||||
this.oTilt = this.tilt;
|
this.oTilt = this.tilt;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.mojang.minecraft.player;
|
package com.mojang.minecraft.player;
|
||||||
|
|
||||||
import com.mojang.minecraft.Entity;
|
import com.mojang.minecraft.Entity;
|
||||||
|
import com.mojang.minecraft.Minecraft;
|
||||||
import com.mojang.minecraft.level.Level;
|
import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.mob.Mob;
|
import com.mojang.minecraft.mob.Mob;
|
||||||
import com.mojang.minecraft.model.HumanoidModel;
|
import com.mojang.minecraft.model.HumanoidModel;
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.mojang.minecraft.render;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.mojang.minecraft.Minecraft;
|
||||||
|
|
||||||
public class TextureLocation {
|
public class TextureLocation {
|
||||||
|
|
||||||
private String path;
|
private String path;
|
||||||
|
@ -31,11 +33,13 @@ public class TextureLocation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int bindTexture() {
|
public int bindTexture() {
|
||||||
|
Minecraft.getMinecraft().renderer.setLighting(true);
|
||||||
RenderEngine r = new RenderEngine();
|
RenderEngine r = new RenderEngine();
|
||||||
int i = getTexturePointer();
|
int i = getTexturePointer();
|
||||||
if(i != -1) {
|
if(i != -1) {
|
||||||
r.bindTexture(i);
|
r.bindTexture(i);
|
||||||
}
|
}
|
||||||
|
Minecraft.getMinecraft().renderer.setLighting(false);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class FixedFunctionShader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int COLOR = 1;
|
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 TEXTURE0 = 4;
|
||||||
public static final int LIGHTING = 8;
|
public static final int LIGHTING = 8;
|
||||||
public static final int FOG = 16;
|
public static final int FOG = 16;
|
||||||
|
@ -30,7 +30,7 @@ public class FixedFunctionShader {
|
||||||
FixedFunctionShader s = instances[i];
|
FixedFunctionShader s = instances[i];
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
boolean CC_a_color = false;
|
boolean CC_a_color = false;
|
||||||
// boolean CC_a_normal = false;
|
boolean CC_a_normal = false;
|
||||||
boolean CC_a_texture0 = false;
|
boolean CC_a_texture0 = false;
|
||||||
boolean CC_lighting = false;
|
boolean CC_lighting = false;
|
||||||
boolean CC_fog = false;
|
boolean CC_fog = false;
|
||||||
|
@ -39,9 +39,9 @@ public class FixedFunctionShader {
|
||||||
if ((i & COLOR) == COLOR) {
|
if ((i & COLOR) == COLOR) {
|
||||||
CC_a_color = true;
|
CC_a_color = true;
|
||||||
}
|
}
|
||||||
// if ((i & NORMAL) == NORMAL) {
|
if ((i & NORMAL) == NORMAL) {
|
||||||
// CC_a_normal = true;
|
CC_a_normal = true;
|
||||||
// }
|
}
|
||||||
if ((i & TEXTURE0) == TEXTURE0) {
|
if ((i & TEXTURE0) == TEXTURE0) {
|
||||||
CC_a_texture0 = true;
|
CC_a_texture0 = true;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class FixedFunctionShader {
|
||||||
if ((i & UNIT0) == UNIT0) {
|
if ((i & UNIT0) == UNIT0) {
|
||||||
CC_unit0 = true;
|
CC_unit0 = true;
|
||||||
}
|
}
|
||||||
s = new FixedFunctionShader(i, CC_a_color, CC_a_texture0, CC_lighting, CC_fog, CC_alphatest, CC_unit0);
|
s = new FixedFunctionShader(i, CC_a_color, CC_a_normal, CC_a_texture0, CC_lighting, CC_fog, CC_alphatest, CC_unit0);
|
||||||
instances[i] = s;
|
instances[i] = s;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
@ -66,7 +66,7 @@ public class FixedFunctionShader {
|
||||||
private static String shaderSource = null;
|
private static String shaderSource = null;
|
||||||
|
|
||||||
private final boolean enable_color;
|
private final boolean enable_color;
|
||||||
// private final boolean enable_normal;
|
private final boolean enable_normal;
|
||||||
private final boolean enable_texture0;
|
private final boolean enable_texture0;
|
||||||
private final boolean enable_lighting;
|
private final boolean enable_lighting;
|
||||||
private final boolean enable_fog;
|
private final boolean enable_fog;
|
||||||
|
@ -106,10 +106,10 @@ public class FixedFunctionShader {
|
||||||
public final BufferGL genericBuffer;
|
public final BufferGL genericBuffer;
|
||||||
public boolean bufferIsInitialized = false;
|
public boolean bufferIsInitialized = false;
|
||||||
|
|
||||||
private FixedFunctionShader(int j, boolean CC_a_color, boolean CC_a_texture0,
|
private FixedFunctionShader(int j, boolean CC_a_color, boolean CC_a_normal, boolean CC_a_texture0,
|
||||||
boolean CC_lighting, boolean CC_fog, boolean CC_alphatest, boolean CC_unit0) {
|
boolean CC_lighting, boolean CC_fog, boolean CC_alphatest, boolean CC_unit0) {
|
||||||
enable_color = CC_a_color;
|
enable_color = CC_a_color;
|
||||||
// enable_normal = CC_a_normal;
|
enable_normal = CC_a_normal;
|
||||||
enable_texture0 = CC_a_texture0;
|
enable_texture0 = CC_a_texture0;
|
||||||
enable_lighting = CC_lighting;
|
enable_lighting = CC_lighting;
|
||||||
enable_fog = CC_fog;
|
enable_fog = CC_fog;
|
||||||
|
@ -123,8 +123,8 @@ public class FixedFunctionShader {
|
||||||
String source = "";
|
String source = "";
|
||||||
if (enable_color)
|
if (enable_color)
|
||||||
source += "\n#define CC_a_color\n";
|
source += "\n#define CC_a_color\n";
|
||||||
//if (enable_normal)
|
if (enable_normal)
|
||||||
//source += "#define CC_a_normal\n";
|
source += "#define CC_a_normal\n";
|
||||||
if (enable_texture0)
|
if (enable_texture0)
|
||||||
source += "#define CC_a_texture0\n";
|
source += "#define CC_a_texture0\n";
|
||||||
if (enable_lighting)
|
if (enable_lighting)
|
||||||
|
@ -175,12 +175,12 @@ public class FixedFunctionShader {
|
||||||
} else {
|
} else {
|
||||||
a_color = -1;
|
a_color = -1;
|
||||||
}
|
}
|
||||||
//if (enable_normal) {
|
if (enable_normal) {
|
||||||
//a_normal = i++;
|
a_normal = i++;
|
||||||
//_wglBindAttributeLocation(globject, a_normal, "a_normal");
|
_wglBindAttributeLocation(globject, a_normal, "a_normal");
|
||||||
//} else {
|
} else {
|
||||||
a_normal = -1;
|
a_normal = -1;
|
||||||
//}
|
}
|
||||||
|
|
||||||
attributeIndexesToEnable = i;
|
attributeIndexesToEnable = i;
|
||||||
|
|
||||||
|
@ -206,7 +206,6 @@ public class FixedFunctionShader {
|
||||||
|
|
||||||
if (enable_lighting) {
|
if (enable_lighting) {
|
||||||
u_normalUniform = _wglGetUniformLocation(globject, "normalUniform");
|
u_normalUniform = _wglGetUniformLocation(globject, "normalUniform");
|
||||||
// u_invertNormals = _wglGetUniformLocation(globject, "invertNormals");
|
|
||||||
u_light0Pos = _wglGetUniformLocation(globject, "light0Pos");
|
u_light0Pos = _wglGetUniformLocation(globject, "light0Pos");
|
||||||
u_light1Pos = _wglGetUniformLocation(globject, "light1Pos");
|
u_light1Pos = _wglGetUniformLocation(globject, "light1Pos");
|
||||||
}
|
}
|
||||||
|
@ -246,10 +245,10 @@ public class FixedFunctionShader {
|
||||||
_wglEnableVertexAttribArray(a_color);
|
_wglEnableVertexAttribArray(a_color);
|
||||||
_wglVertexAttribPointer(a_color, 4, _wGL_UNSIGNED_BYTE, true, 28, 20);
|
_wglVertexAttribPointer(a_color, 4, _wGL_UNSIGNED_BYTE, true, 28, 20);
|
||||||
}
|
}
|
||||||
//if (enable_normal) {
|
if (enable_normal) {
|
||||||
//_wglEnableVertexAttribArray(a_normal);
|
_wglEnableVertexAttribArray(a_normal);
|
||||||
//_wglVertexAttribPointer(a_normal, 4, _wGL_UNSIGNED_BYTE, true, 28, 24);
|
_wglVertexAttribPointer(a_normal, 4, _wGL_UNSIGNED_BYTE, true, 28, 24);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useProgram() {
|
public void useProgram() {
|
||||||
|
|
|
@ -1467,9 +1467,9 @@ public class EaglerAdapterImpl2 {
|
||||||
return ret.buffer;
|
return ret.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void beginPlayback(String fileName) {
|
public static int beginPlayback(String fileName) {
|
||||||
AudioBuffer b = getBufferFor(fileName);
|
AudioBuffer b = getBufferFor(fileName);
|
||||||
if(b == null) return;
|
if(b == null) return -1;
|
||||||
AudioBufferSourceNode s = audioctx.createBufferSource();
|
AudioBufferSourceNode s = audioctx.createBufferSource();
|
||||||
s.setBuffer(b);
|
s.setBuffer(b);
|
||||||
PannerNode p = audioctx.createPanner();
|
PannerNode p = audioctx.createPanner();
|
||||||
|
@ -1479,8 +1479,31 @@ public class EaglerAdapterImpl2 {
|
||||||
g.connect(p);
|
g.connect(p);
|
||||||
p.connect(audioctx.getDestination());
|
p.connect(audioctx.getDestination());
|
||||||
s.start(0.0d, playbackOffsetDelay);
|
s.start(0.0d, playbackOffsetDelay);
|
||||||
|
final int theId = ++playbackId;
|
||||||
|
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(s, p, g));
|
||||||
|
s.setOnEnded(new EventListener<MediaEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(MediaEvent evt) {
|
||||||
|
activeSoundEffects.remove(theId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
return theId;
|
||||||
|
}
|
||||||
|
public static void beginPlayback(String fileName, float volume) {
|
||||||
|
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(volume > 1.0f ? 1.0f : volume);
|
||||||
|
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) {
|
public static final int beginPlayback(String fileName, float x, float y, float z, float volume) {
|
||||||
AudioBuffer b = getBufferFor(fileName);
|
AudioBuffer b = getBufferFor(fileName);
|
||||||
if(b == null) return -1;
|
if(b == null) return -1;
|
||||||
|
|
|
@ -36,6 +36,11 @@ public class Tessellator {
|
||||||
*/
|
*/
|
||||||
private boolean hasTexture = false;
|
private boolean hasTexture = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the current draw object for this tessellator has normal values.
|
||||||
|
*/
|
||||||
|
private boolean hasNormals = false;
|
||||||
|
|
||||||
/** The index into the raw buffer to be used for the next data. */
|
/** The index into the raw buffer to be used for the next data. */
|
||||||
private int rawBufferIndex = 0;
|
private int rawBufferIndex = 0;
|
||||||
|
|
||||||
|
@ -64,6 +69,9 @@ public class Tessellator {
|
||||||
*/
|
*/
|
||||||
private double zOffset;
|
private double zOffset;
|
||||||
|
|
||||||
|
/** The normal to be applied to the face being drawn. */
|
||||||
|
private int normal;
|
||||||
|
|
||||||
/** The static instance of the Tessellator. */
|
/** The static instance of the Tessellator. */
|
||||||
public static final Tessellator instance = new Tessellator(525000);
|
public static final Tessellator instance = new Tessellator(525000);
|
||||||
|
|
||||||
|
@ -105,9 +113,9 @@ public class Tessellator {
|
||||||
GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.hasNormals) {
|
if (this.hasNormals) {
|
||||||
// GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||||
// }
|
}
|
||||||
|
|
||||||
GL11.glDrawArrays(drawMode, 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));
|
||||||
|
|
||||||
|
@ -119,9 +127,9 @@ public class Tessellator {
|
||||||
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.hasNormals) {
|
if (this.hasNormals) {
|
||||||
// GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int var1 = this.rawBufferIndex * 4;
|
int var1 = this.rawBufferIndex * 4;
|
||||||
|
@ -145,12 +153,10 @@ public class Tessellator {
|
||||||
* mode).
|
* mode).
|
||||||
*/
|
*/
|
||||||
public void startDrawing(int drawMode) {
|
public void startDrawing(int drawMode) {
|
||||||
// if (this.isDrawing) {
|
|
||||||
// this.draw();
|
|
||||||
// }
|
|
||||||
this.drawMode = drawMode;
|
this.drawMode = drawMode;
|
||||||
this.isDrawing = true;
|
this.isDrawing = true;
|
||||||
this.reset();
|
this.reset();
|
||||||
|
this.hasNormals = false;
|
||||||
this.hasColor = false;
|
this.hasColor = false;
|
||||||
this.hasTexture = false;
|
this.hasTexture = false;
|
||||||
this.isColorDisabled = false;
|
this.isColorDisabled = false;
|
||||||
|
@ -264,6 +270,10 @@ public class Tessellator {
|
||||||
intBuffer0.set(bufferIndex + 5, this.color);
|
intBuffer0.set(bufferIndex + 5, this.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.hasNormals) {
|
||||||
|
intBuffer0.set(bufferIndex + 6, this.normal);
|
||||||
|
}
|
||||||
|
|
||||||
this.rawBufferIndex += 7;
|
this.rawBufferIndex += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,6 +310,12 @@ public class Tessellator {
|
||||||
* Sets the normal for the current draw call.
|
* Sets the normal for the current draw call.
|
||||||
*/
|
*/
|
||||||
public void setNormal(float par1, float par2, float par3) {
|
public void setNormal(float par1, float par2, float par3) {
|
||||||
|
this.hasNormals = true;
|
||||||
|
float len = (float) Math.sqrt(par1 * par1 + par2 * par2 + par3 * par3);
|
||||||
|
int var4 = (int)((par1 / len) * 125.0F) + 125;
|
||||||
|
int var5 = (int)((par2 / len) * 125.0F) + 125;
|
||||||
|
int var6 = (int)((par3 / len) * 125.0F) + 125;
|
||||||
|
this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16;
|
||||||
GL11.glNormal3f(par1, par2, par3);
|
GL11.glNormal3f(par1, par2, par3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
private static DisplayList compilingDisplayList = null;
|
private static DisplayList compilingDisplayList = null;
|
||||||
|
|
||||||
private static boolean enableColorArray = false;
|
private static boolean enableColorArray = false;
|
||||||
//private static boolean enableNormalArray = false;
|
private static boolean enableNormalArray = false;
|
||||||
private static boolean enableTex0Array = false;
|
private static boolean enableTex0Array = false;
|
||||||
|
|
||||||
private static float colorR = 1.0f;
|
private static float colorR = 1.0f;
|
||||||
|
@ -745,9 +745,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
case GL_COLOR_ARRAY:
|
case GL_COLOR_ARRAY:
|
||||||
enableColorArray = true;
|
enableColorArray = true;
|
||||||
break;
|
break;
|
||||||
// case GL_NORMAL_ARRAY:
|
case GL_NORMAL_ARRAY:
|
||||||
// enableNormalArray = true;
|
enableNormalArray = true;
|
||||||
// break;
|
break;
|
||||||
case GL_TEXTURE_COORD_ARRAY:
|
case GL_TEXTURE_COORD_ARRAY:
|
||||||
enableTex0Array = true;
|
enableTex0Array = true;
|
||||||
break;
|
break;
|
||||||
|
@ -761,9 +761,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
case GL_COLOR_ARRAY:
|
case GL_COLOR_ARRAY:
|
||||||
enableColorArray = false;
|
enableColorArray = false;
|
||||||
break;
|
break;
|
||||||
// case GL_NORMAL_ARRAY:
|
case GL_NORMAL_ARRAY:
|
||||||
// enableNormalArray = false;
|
enableNormalArray = false;
|
||||||
// break;
|
break;
|
||||||
case GL_TEXTURE_COORD_ARRAY:
|
case GL_TEXTURE_COORD_ARRAY:
|
||||||
enableTex0Array = false;
|
enableTex0Array = false;
|
||||||
break;
|
break;
|
||||||
|
@ -775,7 +775,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
private static final int getShaderModeFlag0() {
|
private static final int getShaderModeFlag0() {
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 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 | (enableTex0Array ? FixedFunctionShader.TEXTURE0 : 0));
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
@ -792,7 +792,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
private static final int getShaderModeFlag() {
|
private static final int getShaderModeFlag() {
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 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 | (enableTex0Array ? FixedFunctionShader.TEXTURE0 : 0));
|
||||||
mode = (mode | ((enableColorMaterial && enableLighting) ? FixedFunctionShader.LIGHTING : 0));
|
mode = (mode | ((enableColorMaterial && enableLighting) ? FixedFunctionShader.LIGHTING : 0));
|
||||||
mode = (mode | (fogEnabled ? FixedFunctionShader.FOG : 0));
|
mode = (mode | (fogEnabled ? FixedFunctionShader.FOG : 0));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user