當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityRenderer.renderWorldPass方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.EntityRenderer.renderWorldPass方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityRenderer.renderWorldPass方法的具體用法?Java EntityRenderer.renderWorldPass怎麽用?Java EntityRenderer.renderWorldPass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.EntityRenderer的用法示例。


在下文中一共展示了EntityRenderer.renderWorldPass方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderWorld

import net.minecraft.client.renderer.EntityRenderer; //導入方法依賴的package包/類
@Override
public void renderWorld(EntityRenderer er, Minecraft mc, Framebuffer framebuffer, Shader shader,
		int[] framebufferTextures, float partialTicks, long finishTimeNano, int width, int height, float sizeIncrease) {
	RenderUtil.render360 = false;
	RenderUtil.partialWidth = mc.displayWidth;
	RenderUtil.partialHeight = mc.displayHeight;
	er.renderWorldPass(2, partialTicks, finishTimeNano);
}
 
開發者ID:shaunlebron,項目名稱:flex-fov,代碼行數:9,代碼來源:Standard.java

示例2: renderWorld

import net.minecraft.client.renderer.EntityRenderer; //導入方法依賴的package包/類
/**
 * Render the world.
 * Called between {@link net.minecraft.client.renderer.EntityRenderer#renderWorld(float, long) renderWorld}
 * and {@link net.minecraft.client.renderer.EntityRenderer#renderWorldPass(int, float, long) renderWorldPass}
 */
public void renderWorld(EntityRenderer er, Minecraft mc, Framebuffer framebuffer, Shader shader,
		int[] framebufferTextures, float partialTicks, long finishTimeNano, int width, int height, float sizeIncrease) {
	//save the players state
	player = mc.getRenderViewEntity();
	yaw = player.rotationYaw;
	pitch = player.rotationPitch;
	prevYaw = player.prevRotationYaw;
	prevPitch = player.prevRotationPitch;

	//clear the primary framebuffer
	mc.getFramebuffer().framebufferClear();
	//clear the secondary framebuffer
	framebuffer.framebufferClear();
	//bind the secondary framebuffer
	framebuffer.bindFramebuffer(false);

	//displayWidth and displayHeight are called during world rendering
	//set them to the secondary framebuffer dimensions
	mc.displayWidth = (int)(height*sizeIncrease);
	mc.displayHeight = (int)(height*sizeIncrease); //Must be square

	RenderUtil.partialWidth = mc.displayWidth; //TODO is this even needed?
	RenderUtil.partialHeight = mc.displayHeight; //TODO remove

	RenderUtil.render360 = true;

	Globe globe = globes[globeIndex];
	for (int i=0; i<globe.getCount(); i++) {
		// set camera/player rotation state (read by hooks at the correct moment)
		coordFrame = globe.getCoordFrame(i);
		playerFov = globe.getFov(i);

		// the forward vector is the opposite direction of the z-axis
		float x = -coordFrame.get(2);
		float y = -coordFrame.get(6);
		float z = -coordFrame.get(10);

		// calculate the delta yaw/pitch to point the player
		float lon = (float)Math.atan2(x, -z);
		float lat = (float)Math.atan2(y, Math.sqrt(x*x+z*z));
		playerDeltaYaw = lon;
		playerDeltaPitch = lat;

		// render to texture
		OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, framebufferTextures[i], 0);
		GlStateManager.bindTexture(0);
		er.renderWorldPass(2, partialTicks, finishTimeNano);

		// reset player view
		player.rotationYaw = yaw;
		player.rotationPitch = pitch;
		player.prevRotationYaw = prevYaw;
		player.prevRotationPitch = prevPitch;
	}

	//reset displayWidth and displayHeight to the primary framebuffer dimensions
	mc.displayWidth = width;
	mc.displayHeight = height;

	//reset viewport to full screen
	GlStateManager.viewport(0, 0, width, height);
	//bind primary framebuffer
	mc.getFramebuffer().bindFramebuffer(false);

	if (!getResizeGui() || mc.gameSettings.hideGUI) {
		GL20.glUseProgram(shader.getShaderProgram());
		int cursorUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "drawCursor");
		GL20.glUniform1i(cursorUniform, 0);
		runShader(mc, shader, framebufferTextures);
	}
}
 
開發者ID:shaunlebron,項目名稱:flex-fov,代碼行數:77,代碼來源:RenderMethod.java


注:本文中的net.minecraft.client.renderer.EntityRenderer.renderWorldPass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。