Skip to content

Commit

Permalink
Added more comments and changed a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
ata4 committed May 23, 2015
1 parent 0aa3316 commit 48c7385
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ public void enable() {
}

public void disable() {
if (enabled) {
ClippingHelperAccessor.setCullingEnabled(true);
}

enabled = false;
ClippingHelperAccessor.setCullingEnabled(true);
}

public void toggle() {
Expand All @@ -136,6 +139,7 @@ private boolean modifierKeyPressed() {
public void onKeyInput(InputEvent.KeyInputEvent evt) {
boolean mod = modifierKeyPressed();

// change perspecives, using modifier key for opposite sides
if (keyToggle.isKeyDown()) {
if (mod) {
freeCam = !freeCam;
Expand All @@ -155,6 +159,9 @@ public void onKeyInput(InputEvent.KeyInputEvent evt) {
yRot = mod ? 180 : 0;
}

// update stepped rotation/zoom controls
// note: the smooth controls are handled in onFogDensity, since they need
// to be executed on every frame
if (mod) {
updateZoomAndRotation(1);

Expand Down Expand Up @@ -190,11 +197,7 @@ private void updateZoomAndRotation(double multi) {

@SubscribeEvent
public void onTick(ClientTickEvent evt) {
if (!enabled) {
return;
}

if (evt.phase != Phase.START) {
if (!enabled || evt.phase != Phase.START) {
return;
}

Expand All @@ -221,6 +224,7 @@ public void onFogDensity(EntityViewRenderEvent.FogDensity evt) {
float width = zoom * (MC.displayWidth / (float) MC.displayHeight);
float height = zoom;

// override projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

Expand All @@ -241,13 +245,13 @@ public void onFogDensity(EntityViewRenderEvent.FogDensity evt) {
yRot = MC.thePlayer.rotationYaw - 180;
}

// set camera rotation
// override camera view matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(xRot, 1, 0, 0);
glRotatef(yRot, 0, 1, 0);

// fix particle rotation
// fix particle rotation if the camera isn't following the player view
if (!freeCam) {
float pitch = xRot;
float yaw = yRot + 180;
Expand Down

0 comments on commit 48c7385

Please sign in to comment.