当前位置: 首页>>代码示例>>Java>>正文


Java GLU.gluUnProject方法代码示例

本文整理汇总了Java中org.lwjgl.util.glu.GLU.gluUnProject方法的典型用法代码示例。如果您正苦于以下问题:Java GLU.gluUnProject方法的具体用法?Java GLU.gluUnProject怎么用?Java GLU.gluUnProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.util.glu.GLU的用法示例。


在下文中一共展示了GLU.gluUnProject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateRenderInfo

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_)
{
    GlStateManager.getFloat(2982, MODELVIEW);
    GlStateManager.getFloat(2983, PROJECTION);
    GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT);
    float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
    float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
    position = new Vec3((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
    int i = p_74583_1_ ? 1 : 0;
    float f2 = entityplayerIn.rotationPitch;
    float f3 = entityplayerIn.rotationYaw;
    rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:ActiveRenderInfo.java

示例2: updateRenderInfo

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_)
{
    GlStateManager.getFloat(2982, MODELVIEW);
    GlStateManager.getFloat(2983, PROJECTION);
    GlStateManager.glGetInteger(2978, VIEWPORT);
    float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
    float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
    position = new Vec3d((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
    int i = p_74583_1_ ? 1 : 0;
    float f2 = entityplayerIn.rotationPitch;
    float f3 = entityplayerIn.rotationYaw;
    rotationX = MathHelper.cos(f3 * 0.017453292F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * 0.017453292F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * 0.017453292F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * 0.017453292F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * 0.017453292F);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:ActiveRenderInfo.java

示例3: updateRenderInfo

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer par0EntityPlayer, boolean par1)
{
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
    float var2 = (float)((viewport.get(0) + viewport.get(2)) / 2);
    float var3 = (float)((viewport.get(1) + viewport.get(3)) / 2);
    GLU.gluUnProject(var2, var3, 0.0F, modelview, projection, viewport, objectCoords);
    objectX = objectCoords.get(0);
    objectY = objectCoords.get(1);
    objectZ = objectCoords.get(2);
    int var4 = par1 ? 1 : 0;
    float var5 = par0EntityPlayer.rotationPitch;
    float var6 = par0EntityPlayer.rotationYaw;
    rotationX = MathHelper.cos(var6 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
    rotationZ = MathHelper.sin(var6 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
    rotationYZ = -rotationZ * MathHelper.sin(var5 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
    rotationXY = rotationX * MathHelper.sin(var5 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2);
    rotationXZ = MathHelper.cos(var5 * (float)Math.PI / 180.0F);
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:24,代码来源:ActiveRenderInfo.java

示例4: doEye

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
private void doEye()
{
    int mouseX = Mouse.getX();
    int mouseY = Mouse.getY();
    FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    FloatBuffer projection = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
    IntBuffer viewport = BufferUtils.createIntBuffer(16);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
    float winX = mouseX;
    float winY = viewport.get(3) - mouseY;
    FloatBuffer winZBuffer = BufferUtils.createFloatBuffer(1);
    GL11.glReadPixels(mouseX, mouseY, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZBuffer);
    float winZ = winZBuffer.get(0);
    FloatBuffer pos = BufferUtils.createFloatBuffer(3);
    GLU.gluUnProject(winX, winY, winZ, modelview, projection, viewport, pos);
    mEyeRay = new Point3f(pos.get(0), pos.get(1), pos.get(2));
}
 
开发者ID:StarMade,项目名称:SMEditClassic,代码行数:20,代码来源:JGLCanvas.java

示例5: updateRenderInfo

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public static void updateRenderInfo(EntityPlayer p_74583_0_, boolean p_74583_1_)
{
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
    float f = (float)((viewport.get(0) + viewport.get(2)) / 2);
    float f1 = (float)((viewport.get(1) + viewport.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, modelview, projection, viewport, objectCoords);
    objectX = objectCoords.get(0);
    objectY = objectCoords.get(1);
    objectZ = objectCoords.get(2);
    int i = p_74583_1_ ? 1 : 0;
    float f2 = p_74583_0_.rotationPitch;
    float f3 = p_74583_0_.rotationYaw;
    rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:21,代码来源:ActiveRenderInfo.java

示例6: func_74583_a

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public static void func_74583_a(EntityPlayer p_74583_0_, boolean p_74583_1_) {
   GL11.glGetFloat(2982, field_74594_j);
   GL11.glGetFloat(2983, field_74595_k);
   GL11.glGetInteger(2978, field_74597_i);
   float var2 = (float)((field_74597_i.get(0) + field_74597_i.get(2)) / 2);
   float var3 = (float)((field_74597_i.get(1) + field_74597_i.get(3)) / 2);
   GLU.gluUnProject(var2, var3, 0.0F, field_74594_j, field_74595_k, field_74597_i, field_74593_l);
   field_74592_a = field_74593_l.get(0);
   field_74590_b = field_74593_l.get(1);
   field_74591_c = field_74593_l.get(2);
   int var4 = p_74583_1_?1:0;
   float var5 = p_74583_0_.field_70125_A;
   float var6 = p_74583_0_.field_70177_z;
   field_74588_d = MathHelper.func_76134_b(var6 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
   field_74586_f = MathHelper.func_76126_a(var6 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
   field_74587_g = -field_74586_f * MathHelper.func_76126_a(var5 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
   field_74596_h = field_74588_d * MathHelper.func_76126_a(var5 * 3.1415927F / 180.0F) * (float)(1 - var4 * 2);
   field_74589_e = MathHelper.func_76134_b(var5 * 3.1415927F / 180.0F);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:20,代码来源:ActiveRenderInfo.java

示例7: updateRenderInfo

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer par0EntityPlayer, boolean par1)
{
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
    float f = (float)((viewport.get(0) + viewport.get(2)) / 2);
    float f1 = (float)((viewport.get(1) + viewport.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, modelview, projection, viewport, objectCoords);
    objectX = objectCoords.get(0);
    objectY = objectCoords.get(1);
    objectZ = objectCoords.get(2);
    int i = par1 ? 1 : 0;
    float f2 = par0EntityPlayer.rotationPitch;
    float f3 = par0EntityPlayer.rotationYaw;
    rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:24,代码来源:ActiveRenderInfo.java

示例8: doEye

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
private void doEye() {
    int mouseX = Mouse.getX();
    int mouseY = Mouse.getY();
    FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    FloatBuffer projection = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
    IntBuffer viewport = BufferUtils.createIntBuffer(16);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
    float winX = mouseX;
    float winY = viewport.get(3) - mouseY;
    FloatBuffer winZBuffer = BufferUtils.createFloatBuffer(1);
    GL11.glReadPixels(mouseX, mouseY, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZBuffer);
    float winZ = winZBuffer.get(0);
    FloatBuffer pos = BufferUtils.createFloatBuffer(3);
    GLU.gluUnProject(winX, winY, winZ, modelview, projection, viewport, pos);
    mEyeRay = new Point3f(pos.get(0), pos.get(1), pos.get(2));
}
 
开发者ID:StarMade,项目名称:SMEdit,代码行数:19,代码来源:JGLCanvas.java

示例9: toWorld

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
/**
 * Converts the specified X, Y, and Z screen positions
 * to a position in the world, that through some fancy
 * maths (raytracing) can be used get the actual block
 * position of the conversion
 *
 * @return World projected coordinates
 */
public static Vec3 toWorld(double x, double y, double z) {
    FloatBuffer screenCoords = BufferUtils.createFloatBuffer(3);
    boolean result = GLU.gluUnProject((float) x, (float) y, (float) z, MODELVIEW, PROJECTION, VIEWPORT, screenCoords);
    if (result) {
        return new Vec3(screenCoords.get(0), Display.getHeight() - screenCoords.get(1), screenCoords.get(2));
    }
    return null;
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:17,代码来源:GLUtils.java

示例10: getRayTrace

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public static RayTrace getRayTrace() 
	{
		FloatBuffer model = BufferUtils.createFloatBuffer(16);
		FloatBuffer projection = BufferUtils.createFloatBuffer(16);
		IntBuffer viewport = BufferUtils.createIntBuffer(16);

		GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, model);
		GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
		GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
		
		FloatBuffer posNearBuffer = BufferUtils.createFloatBuffer(3);
		FloatBuffer posFarBuffer = BufferUtils.createFloatBuffer(3);

		GLU.gluUnProject(Mouse.getX(), Mouse.getY(), 0.0F, model, projection, viewport, posNearBuffer);
		GLU.gluUnProject(Mouse.getX(), Mouse.getY(), 1.0F, model, projection, viewport, posFarBuffer);

		float[] posNear = new float[3];
		float[] posFar = new float[3];
		
		for(int i = 0; i < 3; i++)
		{
			posNear[i] = posNearBuffer.get(i);
			posFar[i] = posFarBuffer.get(i);
		}

		Vec3d v = new Vec3d(posNear[0], posNear[1], posNear[2]);
		Vec3d w = new Vec3d(posFar[0], posFar[1], posFar[2]);
		
		return new RayTrace(v,w);
		
//		entityModel.clearHighlights();
//		PartObj p = entityModel.testRay(new RayTrace(v,w));
//		if(p != null)
//			hoveredPart = p.getName();
//		else
//			hoveredPart = null;
	}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:38,代码来源:RayTrace.java

示例11: unproject

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public Vec3 unproject(float winX, float winY, float winZ) {
    GLU.gluUnProject(winX, winY, winZ, modelview, projection, viewport, objectCoords);

    float objectX = objectCoords.get(0);
    float objectY = objectCoords.get(1);
    float objectZ = objectCoords.get(2);

    return Vec3.createVectorHelper(objectX, objectY, objectZ);
}
 
开发者ID:awesommist,项目名称:DynamicLib,代码行数:10,代码来源:ProjectionHelper.java

示例12: projectToScreen

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
private void projectToScreen(JGLNode obj) 
    {
        if ((obj.getLowBounds() == null) && (obj.getHighBounds() == null) && (obj.getData("pointMap") == null))
            return;
        FloatBuffer modelView = BufferUtils.createFloatBuffer(16);
        FloatBuffer projection = BufferUtils.createFloatBuffer(16);
        FloatBuffer dviewport = BufferUtils.createFloatBuffer(16);

        GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelView);
        GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
        GL11.glGetFloat(GL11.GL_VIEWPORT, dviewport);

        IntBuffer viewport = BufferLogic.create((int)dviewport.get(0), (int)dviewport.get(1), (int)dviewport.get(2), (int)dviewport.get(3));
        if ((obj.getLowBounds() != null) && (obj.getHighBounds() != null))
        {
            FloatBuffer low = BufferLogic.createFloatBuffer(3);
            GLU.gluProject(obj.getLowBounds().x, obj.getLowBounds().y, obj.getLowBounds().z, modelView, projection, viewport, low);
            FloatBuffer high = BufferLogic.createFloatBuffer(3);
            GLU.gluProject(obj.getHighBounds().x, obj.getHighBounds().y, obj.getHighBounds().z, modelView, projection, viewport, high);
            FloatBuffer mid = BufferLogic.createFloatBuffer(3);
            GLU.gluProject(0, 0, 0, modelView, projection, viewport, mid);
            obj.setScreen(new Point3f(mid.get(0), mid.get(1), mid.get(2)));
            obj.setScreenLowBounds(new Point3f((float)Math.min(low.get(0), high.get(0)), (float)Math.min(low.get(1), high.get(1)), (float)Math.min(low.get(2), high.get(2))));
            obj.setScreenHighBounds(new Point3f((float)Math.max(low.get(0), high.get(0)), (float)Math.max(low.get(1), high.get(1)), (float)Math.max(low.get(2), high.get(2))));
//        System.out.println("modelView="+DoubleUtils.toString(modelView));
//        System.out.println("projection="+DoubleUtils.toString(projection));
//        System.out.println("dviewport="+DoubleUtils.toString(dviewport));
//        System.out.println("Screen="+DoubleUtils.toString(mid));
        }
        Point3f pointMap = (Point3f)obj.getData("pointMap");
        if (pointMap != null)
        {
            FloatBuffer pointMapped = BufferLogic.createFloatBuffer(3);
            GLU.gluUnProject(pointMap.x, pointMap.y, pointMap.z, modelView, projection, viewport, pointMapped);
            Point3f pMapped = new Point3f(pointMapped.get(0), pointMapped.get(1), pointMapped.get(2));
            obj.setData("pointMap", null);
            obj.setData("pointMapped", pMapped);
        }
    }
 
开发者ID:StarMade,项目名称:SMEditClassic,代码行数:40,代码来源:NodeDrawHandler.java

示例13: renderLast

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderLast(RenderWorldLastEvent evt) {
	if (EntityCamera.isActive()) {
		GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelviewF);
		GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projectionF);
		GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);

		float x = Mouse.getX();
		float y = Mouse.getY();

		FloatBuffer winZ = GLAllocation.createDirectFloatBuffer(1);

		GL11.glReadPixels((int) x, (int) y, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZ);
		GLU.gluUnProject(x, y, 0F, modelviewF, projectionF, viewport, posClose);
		GLU.gluUnProject(x, y, 1F, modelviewF, projectionF, viewport, posFar);

		close = Vec3.createVectorHelper(posClose.get(0), posClose.get(1), posClose.get(2));
		far = Vec3.createVectorHelper(posFar.get(0), posFar.get(1), posFar.get(2));

		// Draw selection box
		if (EntityCamera.mouseover != null) {
			drawBlockBounds(EntityCamera.activeCamera, EntityCamera.mouseover);
		}
	}

	//TODO Render selected minion movement target
}
 
开发者ID:dmillerw,项目名称:RoboticMinions,代码行数:29,代码来源:RenderHelper.java

示例14: projectToScreen

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
private void projectToScreen(JGLNode obj) {
        if ((obj.getLowBounds() == null) && (obj.getHighBounds() == null) && (obj.getData("pointMap") == null)) {
            return;
        }
        FloatBuffer modelView = BufferUtils.createFloatBuffer(16);
        FloatBuffer projection = BufferUtils.createFloatBuffer(16);
        FloatBuffer dviewport = BufferUtils.createFloatBuffer(16);

        GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelView);
        GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
        GL11.glGetFloat(GL11.GL_VIEWPORT, dviewport);

        IntBuffer viewport = BufferLogic.create((int) dviewport.get(0), (int) dviewport.get(1), (int) dviewport.get(2), (int) dviewport.get(3));
        if ((obj.getLowBounds() != null) && (obj.getHighBounds() != null)) {
            FloatBuffer low = BufferLogic.createFloatBuffer(3);
            GLU.gluProject(obj.getLowBounds().x, obj.getLowBounds().y, obj.getLowBounds().z, modelView, projection, viewport, low);
            FloatBuffer high = BufferLogic.createFloatBuffer(3);
            GLU.gluProject(obj.getHighBounds().x, obj.getHighBounds().y, obj.getHighBounds().z, modelView, projection, viewport, high);
            FloatBuffer mid = BufferLogic.createFloatBuffer(3);
            GLU.gluProject(0, 0, 0, modelView, projection, viewport, mid);
            obj.setScreen(new Point3f(mid.get(0), mid.get(1), mid.get(2)));
            obj.setScreenLowBounds(new Point3f(Math.min(low.get(0), high.get(0)), Math.min(low.get(1), high.get(1)), Math.min(low.get(2), high.get(2))));
            obj.setScreenHighBounds(new Point3f(Math.max(low.get(0), high.get(0)), Math.max(low.get(1), high.get(1)), Math.max(low.get(2), high.get(2))));
//        System.out.println("modelView="+DoubleUtils.toString(modelView));
//        System.out.println("projection="+DoubleUtils.toString(projection));
//        System.out.println("dviewport="+DoubleUtils.toString(dviewport));
//        System.out.println("Screen="+DoubleUtils.toString(mid));
        }
        Point3f pointMap = (Point3f) obj.getData("pointMap");
        if (pointMap != null) {
            FloatBuffer pointMapped = BufferLogic.createFloatBuffer(3);
            GLU.gluUnProject(pointMap.x, pointMap.y, pointMap.z, modelView, projection, viewport, pointMapped);
            Point3f pMapped = new Point3f(pointMapped.get(0), pointMapped.get(1), pointMapped.get(2));
            obj.setData("pointMap", null);
            obj.setData("pointMapped", pMapped);
        }
    }
 
开发者ID:StarMade,项目名称:SMEdit,代码行数:38,代码来源:NodeDrawHandler.java

示例15: getRayFromMouse

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public Ray getRayFromMouse() {

        int mousex = 0, mousey = 0;
        mousex = Mouse.getX();
        mousey = Mouse.getY();
        final FloatBuffer projection = BufferUtils.createFloatBuffer(16);
        final FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
        final IntBuffer viewport = BufferUtils.createIntBuffer(16);
        final FloatBuffer position = BufferUtils.createFloatBuffer(3);
        GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
        GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
        GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);

        GLU.gluUnProject(mousex, mousey, 1, modelview, projection, viewport, position);
        final Vector3f near = new Vector3f(position.get(0), position.get(1), position.get(2));
        // reuse buffers
        // near = eyeOut;
        projection.rewind();
        modelview.rewind();
        viewport.rewind();
        position.rewind();
        GLU.gluUnProject(mousex, mousey, 0, modelview, projection, viewport, position);
        final Vector3f far = new Vector3f(position.get(0), position.get(1), position.get(2));
        Vector3f.sub(near, far, this.vView);
        this.vView.normalise();
        return new Ray(this.m_vPosition, this.vView);
    }
 
开发者ID:JMaNGOS,项目名称:JMaNGOS,代码行数:28,代码来源:Camera.java


注:本文中的org.lwjgl.util.glu.GLU.gluUnProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。