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


Java FloatBuffer.get方法代码示例

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


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

示例1: propertyChange

import java.nio.FloatBuffer; //导入方法依赖的package包/类
@Override
    synchronized public void propertyChange(PropertyChangeEvent evt) {
//        if(!isFilterEnabled()) return;
        if ((evt.getPropertyName() == AEFrameChipRenderer.EVENT_NEW_FRAME_AVAILBLE)
                && !chip.getAeViewer().isPaused() && colorBlobDetectionEnabled) {
            FloatBuffer lastFrameBuffer = ((AEFrameChipRenderer)chip.getRenderer()).getPixmap();
            //int sx=chip.getSizeX(), sy=chip.getSizeY();
            AEFrameChipRenderer r=((AEFrameChipRenderer)chip.getRenderer());
            // rewrite frame to avoid padding for texture
            for (int x = 0; x < sx; x++) {
                for (int y = 0; y < sy; y++) {
                    int i=r.getPixMapIndex(x, y),j=(x*3) + ((sy-1-y)*sx*3);
                    lastFrame[j] = lastFrameBuffer.get(i + 2);
                    lastFrame[j+ 1] = lastFrameBuffer.get(i + 1);
                    lastFrame[j+ 2] = lastFrameBuffer.get(i);
                }
            }
            int frameTs = renderer.getTimestampFrameEnd();

                //process frame
            findColorBlobs(false);
            trackBlobs(frameTs);
        }
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:25,代码来源:CdavisFrameBlobDetector.java

示例2: popTransform

import java.nio.FloatBuffer; //导入方法依赖的package包/类
/**
 * Pop a previously pushed transform from the stack to the current. This should
 * only be called if a transform has been previously pushed.
 */
public void popTransform() {
	if (stackIndex == 0) {
		throw new RuntimeException("Attempt to pop a transform that hasn't be pushed");
	}
	
	predraw();
	
	stackIndex--;
	FloatBuffer oldBuffer = (FloatBuffer) stack.get(stackIndex);
	GL.glLoadMatrix(oldBuffer);
	sx = oldBuffer.get(16);
	sy = oldBuffer.get(17);
	
	postdraw();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:20,代码来源:Graphics.java

示例3: calcShape

import java.nio.FloatBuffer; //导入方法依赖的package包/类
public static IFrustrumShape calcShape(FloatBuffer vert, int dimensions){
	if(vert.limit()==0) return new FrustrumBool(false);
	
	Vec3f start=new Vec3f(),end=new Vec3f();
	
	for(int i=0;i<vert.limit();i+=dimensions){
		float p1=vert.get(i+0);
		start.x(Math.min(start.x(), p1));
		end.x(Math.max(end.x(), p1));
		
		if(dimensions>1){
			float p2=vert.get(i+1);
			start.y(Math.min(start.y(), p2));
			end.y(Math.max(end.y(), p2));
			
			if(dimensions>2){
				float p3=vert.get(i+2);
				start.z(Math.min(start.z(), p3));
				end.z(Math.max(end.z(), p3));
			}
		}
	}
	
	return new FrustrumCube(start, end);
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:26,代码来源:ModelLoader.java

示例4: func_181665_a

import java.nio.FloatBuffer; //导入方法依赖的package包/类
private static float func_181665_a(FloatBuffer p_181665_0_, float p_181665_1_, float p_181665_2_, float p_181665_3_, int p_181665_4_, int p_181665_5_)
{
    float f = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 0);
    float f1 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 1);
    float f2 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 2);
    float f3 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 0);
    float f4 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 1);
    float f5 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 2);
    float f6 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 0);
    float f7 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 1);
    float f8 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 2);
    float f9 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 0);
    float f10 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 1);
    float f11 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 2);
    float f12 = (f + f3 + f6 + f9) * 0.25F - p_181665_1_;
    float f13 = (f1 + f4 + f7 + f10) * 0.25F - p_181665_2_;
    float f14 = (f2 + f5 + f8 + f11) * 0.25F - p_181665_3_;
    return f12 * f12 + f13 * f13 + f14 * f14;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:WorldRenderer.java

示例5: getDistanceSq

import java.nio.FloatBuffer; //导入方法依赖的package包/类
private static float getDistanceSq(FloatBuffer p_181665_0_, float p_181665_1_, float p_181665_2_, float p_181665_3_, int p_181665_4_, int p_181665_5_)
{
    float f = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 0);
    float f1 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 1);
    float f2 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 2);
    float f3 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 0);
    float f4 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 1);
    float f5 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 2);
    float f6 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 0);
    float f7 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 1);
    float f8 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 2);
    float f9 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 0);
    float f10 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 1);
    float f11 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 2);
    float f12 = (f + f3 + f6 + f9) * 0.25F - p_181665_1_;
    float f13 = (f1 + f4 + f7 + f10) * 0.25F - p_181665_2_;
    float f14 = (f2 + f5 + f8 + f11) * 0.25F - p_181665_3_;
    return f12 * f12 + f13 * f13 + f14 * f14;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:VertexBuffer.java

示例6: setUpPosition

import java.nio.FloatBuffer; //导入方法依赖的package包/类
public static void setUpPosition()
{
    FloatBuffer floatbuffer = tempMatrixDirectBuffer;
    floatbuffer.clear();
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, floatbuffer);
    floatbuffer.get(tempMat, 0, 16);
    SMath.multiplyMat4xVec4(upPosition, tempMat, upPosModelView);
    setProgramUniform3f("upPosition", upPosition[0], upPosition[1], upPosition[2]);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:Shaders.java

示例7: toWorld

import java.nio.FloatBuffer; //导入方法依赖的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

示例8: getRayTrace

import java.nio.FloatBuffer; //导入方法依赖的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

示例9: getVector3Array

import java.nio.FloatBuffer; //导入方法依赖的package包/类
/**
 * Generates a Vector3f array from the given FloatBuffer.
 * 
 * @param buff
 *            the FloatBuffer to read from
 * @return a newly generated array of Vector3f objects
 */
public static Vector3f[] getVector3Array(FloatBuffer buff) {
    buff.clear();
    Vector3f[] verts = new Vector3f[buff.limit() / 3];
    for (int x = 0; x < verts.length; x++) {
        Vector3f v = new Vector3f(buff.get(), buff.get(), buff.get());
        verts[x] = v;
    }
    return verts;
}
 
开发者ID:asiermarzo,项目名称:Ultraino,代码行数:17,代码来源:BufferUtils.java

示例10: getFloatArray

import java.nio.FloatBuffer; //导入方法依赖的package包/类
/**
 * Create a new float[] array and populate it with the given FloatBuffer's
 * contents.
 * 
 * @param buff
 *            the FloatBuffer to read from
 * @return a new float array populated from the FloatBuffer
 */
public static float[] getFloatArray(FloatBuffer buff) {
    if (buff == null) {
        return null;
    }
    buff.clear();
    float[] inds = new float[buff.limit()];
    for (int x = 0; x < inds.length; x++) {
        inds[x] = buff.get();
    }
    return inds;
}
 
开发者ID:asiermarzo,项目名称:Ultraino,代码行数:20,代码来源:BufferUtils.java

示例11: getVector2Array

import java.nio.FloatBuffer; //导入方法依赖的package包/类
/**
 * Generates a Vector2f array from the given FloatBuffer.
 * 
 * @param buff
 *            the FloatBuffer to read from
 * @return a newly generated array of Vector2f objects
 */
public static Vector2f[] getVector2Array(FloatBuffer buff) {
    buff.clear();
    Vector2f[] verts = new Vector2f[buff.limit() / 2];
    for (int x = 0; x < verts.length; x++) {
        Vector2f v = new Vector2f(buff.get(), buff.get());
        verts[x] = v;
    }
    return verts;
}
 
开发者ID:asiermarzo,项目名称:Ultraino,代码行数:17,代码来源:BufferUtils.java

示例12: readFloatBuffer

import java.nio.FloatBuffer; //导入方法依赖的package包/类
/**
 * <code>readFloatBuffer</code> reads value for this matrix from a FloatBuffer.
 * @param fb the buffer to read from, must be correct size
 * @param columnMajor if true, this buffer should be filled with column
 * 		major data, otherwise it will be filled row major.
 * @return this data as a FloatBuffer.
 */
public Matrix4f readFloatBuffer(FloatBuffer fb, boolean columnMajor) {

    if (columnMajor) {
        m00 = fb.get();
        m10 = fb.get();
        m20 = fb.get();
        m30 = fb.get();
        m01 = fb.get();
        m11 = fb.get();
        m21 = fb.get();
        m31 = fb.get();
        m02 = fb.get();
        m12 = fb.get();
        m22 = fb.get();
        m32 = fb.get();
        m03 = fb.get();
        m13 = fb.get();
        m23 = fb.get();
        m33 = fb.get();
    } else {
        m00 = fb.get();
        m01 = fb.get();
        m02 = fb.get();
        m03 = fb.get();
        m10 = fb.get();
        m11 = fb.get();
        m12 = fb.get();
        m13 = fb.get();
        m20 = fb.get();
        m21 = fb.get();
        m22 = fb.get();
        m23 = fb.get();
        m30 = fb.get();
        m31 = fb.get();
        m32 = fb.get();
        m33 = fb.get();
    }
    return this;
}
 
开发者ID:asiermarzo,项目名称:Ultraino,代码行数:47,代码来源:Matrix4f.java

示例13: modifyHeight

import java.nio.FloatBuffer; //导入方法依赖的package包/类
/**
 * Modify height of terrain points.
 *
 * @param contactPoint the contact point.
 */
private void modifyHeight(@NotNull final Vector3f contactPoint) {

    final LocalObjects local = LocalObjects.get();
    final Node terrainNode = (Node) notNull(getEditedModel());

    final Vector3f worldTranslation = terrainNode.getWorldTranslation();
    final Vector3f localScale = terrainNode.getLocalScale();
    final Vector3f localPoint = contactPoint.subtract(worldTranslation, local.nextVector());
    final Vector2f terrainLoc = local.nextVector2f();
    final Vector2f effectPoint = local.nextVector2f();

    final Terrain terrain = (Terrain) terrainNode;
    final Geometry brush = getBrush();

    final float brushSize = getBrushSize();
    final int twoBrushSize = (int) (brushSize * 2);

    final Basis fractalFilter = createFractalGenerator();
    final FloatBuffer buffer = fractalFilter.getBuffer(terrainLoc.getX(), terrainLoc.getY(), 0, twoBrushSize);

    final int radiusStepsX = (int) (brushSize / localScale.getX());
    final int radiusStepsZ = (int) (brushSize / localScale.getY());

    final float xStepAmount = localScale.getX();
    final float zStepAmount = localScale.getZ();

    final List<Vector2f> locs = new ArrayList<>();
    final List<Float> heights = new ArrayList<>();

    for (int z = -radiusStepsZ, yfb = 0; z < radiusStepsZ; z++, yfb++) {
        for (int x = -radiusStepsX, xfb = 0; x < radiusStepsX; x++, xfb++) {

            final float locX = localPoint.getX() + (x * xStepAmount);
            final float locZ = localPoint.getZ() + (z * zStepAmount);

            effectPoint.set(locX - localPoint.getX(), locZ - localPoint.getZ());

            if (!isContains(brush, effectPoint.getX(), effectPoint.getX())) {
                continue;
            }

            final float height = buffer.get(yfb * twoBrushSize + xfb);

            terrainLoc.set(locX, locZ);

            final float currentHeight = terrain.getHeightmapHeight(terrainLoc) * localScale.getY();
            // see if it is in the radius of the tool
            final float newHeight = calculateHeight(brushSize, height, effectPoint);

            locs.add(terrainLoc.clone());
            heights.add(currentHeight + newHeight);
        }
    }

    locs.forEach(this::change);

    // do the actual height adjustment
    terrain.setHeight(locs, heights);
    terrainNode.updateModelBound(); // or else we won't collide with it where we just edited
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:66,代码来源:RoughTerrainToolControl.java

示例14: glMultMatrixf

import java.nio.FloatBuffer; //导入方法依赖的package包/类
public void glMultMatrixf(FloatBuffer m) {
	m.get(mTemp, MATRIX_SIZE, MATRIX_SIZE);
	glMultMatrixf(mTemp, MATRIX_SIZE);
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:5,代码来源:MatrixStack.java

示例15: containAABB

import java.nio.FloatBuffer; //导入方法依赖的package包/类
/**
 * <code>containAABB</code> creates a minimum-volume axis-aligned bounding
 * box of the points, then selects the smallest enclosing sphere of the box
 * with the sphere centered at the boxes center.
 * 
 * @param points
 *            the list of points.
 */
public void containAABB(FloatBuffer points) {
    if (points == null) {
        return;
    }

    points.rewind();
    if (points.remaining() <= 2) // we need at least a 3 float vector
    {
        return;
    }

    TempVars vars = TempVars.get();
    
    float[] tmpArray = vars.skinPositions;

    float minX = Float.POSITIVE_INFINITY, minY = Float.POSITIVE_INFINITY, minZ = Float.POSITIVE_INFINITY;
    float maxX = Float.NEGATIVE_INFINITY, maxY = Float.NEGATIVE_INFINITY, maxZ = Float.NEGATIVE_INFINITY;
    
    int iterations = (int) M.ceil(points.limit() / ((float) tmpArray.length));
    for (int i = iterations - 1; i >= 0; i--) {
        int bufLength = Math.min(tmpArray.length, points.remaining());
        points.get(tmpArray, 0, bufLength);

        for (int j = 0; j < bufLength; j += 3) {
            vars.vect1.x = tmpArray[j];
            vars.vect1.y = tmpArray[j+1];
            vars.vect1.z = tmpArray[j+2];
            
            if (vars.vect1.x < minX) {
                minX = vars.vect1.x;
            }
            if (vars.vect1.x > maxX) {
                maxX = vars.vect1.x;
            }

            if (vars.vect1.y < minY) {
                minY = vars.vect1.y;
            }
            if (vars.vect1.y > maxY) {
                maxY = vars.vect1.y;
            }

            if (vars.vect1.z < minZ) {
                minZ = vars.vect1.z;
            }
            if (vars.vect1.z > maxZ) {
                maxZ = vars.vect1.z;
            }
        }
    }

    vars.release();

    center.set(minX + maxX, minY + maxY, minZ + maxZ);
    center.multLocal(0.5f);

    xExtent = maxX - center.x;
    yExtent = maxY - center.y;
    zExtent = maxZ - center.z;
}
 
开发者ID:asiermarzo,项目名称:Ultraino,代码行数:69,代码来源:BoundingBox.java


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