MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / setCameraShadow

Method setCameraShadow

src/main/java/net/optifine/shaders/Shaders.java:4415–4514  ·  view source on GitHub ↗
(float partialTicks)

Source from the content-addressed store, hash-verified

4413 }
4414
4415 public static void setCameraShadow(float partialTicks)
4416 {
4417 Entity entity = mc.getRenderViewEntity();
4418 double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
4419 double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
4420 double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
4421 updateCameraOffset(entity);
4422 cameraPositionX = d0 - (double)cameraOffsetX;
4423 cameraPositionY = d1;
4424 cameraPositionZ = d2 - (double)cameraOffsetZ;
4425 GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, (FloatBuffer)projection.position(0));
4426 SMath.invertMat4FBFA((FloatBuffer)projectionInverse.position(0), (FloatBuffer)projection.position(0), faProjectionInverse, faProjection);
4427 projection.position(0);
4428 projectionInverse.position(0);
4429 GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, (FloatBuffer)modelView.position(0));
4430 SMath.invertMat4FBFA((FloatBuffer)modelViewInverse.position(0), (FloatBuffer)modelView.position(0), faModelViewInverse, faModelView);
4431 modelView.position(0);
4432 modelViewInverse.position(0);
4433 GL11.glViewport(0, 0, shadowMapWidth, shadowMapHeight);
4434 GL11.glMatrixMode(GL11.GL_PROJECTION);
4435 GL11.glLoadIdentity();
4436
4437 if (shadowMapIsOrtho)
4438 {
4439 GL11.glOrtho((double)(-shadowMapHalfPlane), (double)shadowMapHalfPlane, (double)(-shadowMapHalfPlane), (double)shadowMapHalfPlane, 0.05000000074505806D, 256.0D);
4440 }
4441 else
4442 {
4443 GLU.gluPerspective(shadowMapFOV, (float)shadowMapWidth / (float)shadowMapHeight, 0.05F, 256.0F);
4444 }
4445
4446 GL11.glMatrixMode(GL11.GL_MODELVIEW);
4447 GL11.glLoadIdentity();
4448 GL11.glTranslatef(0.0F, 0.0F, -100.0F);
4449 GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
4450 celestialAngle = mc.theWorld.getCelestialAngle(partialTicks);
4451 sunAngle = celestialAngle < 0.75F ? celestialAngle + 0.25F : celestialAngle - 0.75F;
4452 float f = celestialAngle * -360.0F;
4453 float f1 = shadowAngleInterval > 0.0F ? f % shadowAngleInterval - shadowAngleInterval * 0.5F : 0.0F;
4454
4455 if ((double)sunAngle <= 0.5D)
4456 {
4457 GL11.glRotatef(f - f1, 0.0F, 0.0F, 1.0F);
4458 GL11.glRotatef(sunPathRotation, 1.0F, 0.0F, 0.0F);
4459 shadowAngle = sunAngle;
4460 }
4461 else
4462 {
4463 GL11.glRotatef(f + 180.0F - f1, 0.0F, 0.0F, 1.0F);
4464 GL11.glRotatef(sunPathRotation, 1.0F, 0.0F, 0.0F);
4465 shadowAngle = sunAngle - 0.5F;
4466 }
4467
4468 if (shadowMapIsOrtho)
4469 {
4470 float f2 = shadowIntervalSize;
4471 float f3 = f2 / 2.0F;
4472 GL11.glTranslatef((float)d0 % f2 - f3, (float)d1 % f2 - f3, (float)d2 % f2 - f3);

Callers 1

renderShadowMapMethod · 0.95

Calls 9

updateCameraOffsetMethod · 0.95
invertMat4FBFAMethod · 0.95
checkGLErrorMethod · 0.95
getRenderViewEntityMethod · 0.80
positionMethod · 0.80
getCelestialAngleMethod · 0.80
cosMethod · 0.80
sinMethod · 0.80

Tested by

no test coverage detected