• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Mode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jme3.scene.Mesh.Mode的典型用法代码示例。如果您正苦于以下问题:Java Mode类的具体用法?Java Mode怎么用?Java Mode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Mode类属于com.jme3.scene.Mesh包,在下文中一共展示了Mode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: BIHTree

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public BIHTree(Mesh mesh, int maxTrisPerNode) {
    this.mesh = mesh;
    this.maxTrisPerNode = maxTrisPerNode;

    if (maxTrisPerNode < 1 || mesh == null) {
        throw new IllegalArgumentException();
    }

    bihSwapTmp = new float[9];

    FloatBuffer vb = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
    IndexBuffer ib = mesh.getIndexBuffer();
    if (ib == null) {
        ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode());
    } else if (mesh.getMode() != Mode.Triangles) {
        ib = new WrappedIndexBuffer(mesh);
    }

    numTris = ib.size() / 3;
    initTriList(vb, ib);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:BIHTree.java


示例2: convertElementMode

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
/*********************************************************************\
|* Render Calls                                                      *|
\*********************************************************************/
public int convertElementMode(Mesh.Mode mode) {
    switch (mode) {
        case Points:
            return GL_POINTS;
        case Lines:
            return GL_LINES;
        case LineLoop:
            return GL_LINE_LOOP;
        case LineStrip:
            return GL_LINE_STRIP;
        case Triangles:
            return GL_TRIANGLES;
        case TriangleFan:
            return GL_TRIANGLE_FAN;
        case TriangleStrip:
            return GL_TRIANGLE_STRIP;
        default:
            throw new UnsupportedOperationException("Unrecognized mesh mode: " + mode);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:24,代码来源:LwjglRenderer.java


示例3: convertElementMode

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
private int convertElementMode(Mesh.Mode mode) {
    switch (mode) {
        case Points:
            return GL_POINTS;
        case Lines:
            return GL_LINES;
        case LineLoop:
            return GL_LINE_LOOP;
        case LineStrip:
            return GL_LINE_STRIP;
        case Triangles:
            return GL_TRIANGLES;
        case TriangleFan:
            return GL_TRIANGLE_FAN;
        case TriangleStrip:
            return GL_TRIANGLE_STRIP;
        default:
            throw new UnsupportedOperationException("Unrecognized mesh mode: " + mode);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:LwjglGL1Renderer.java


示例4: WireSphere

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public WireSphere(float radius) {
        updatePositions(radius);
        ShortBuffer ib = BufferUtils.createShortBuffer(samples * 2 * 2 + zSamples * samples * 2 /*+ 3 * 2*/);
        setBuffer(Type.Index, 2, ib);

//        ib.put(new byte[]{
//            (byte) 0, (byte) 1,
//            (byte) 2, (byte) 3,
//            (byte) 4, (byte) 5,
//        });

//        int curNum = 3 * 2;
        int curNum = 0;
        for (int j = 0; j < 2 + zSamples; j++) {
            for (int i = curNum; i < curNum + samples - 1; i++) {
                ib.put((short) i).put((short) (i + 1));
            }
            ib.put((short) (curNum + samples - 1)).put((short) curNum);
            curNum += samples;
        }

        setMode(Mode.Lines);

        updateBound();
        updateCounts();
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:WireSphere.java


示例5: toJME

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public static Mesh.Mode toJME(Meshes.Mesh.Primitive v) {
	switch(v){
		case line_strip:
			return Mode.LineStrip;
		case lines:
			return Mode.Lines;
		case points:
			return Mode.Points;
		case triangle_strip:
			return Mode.TriangleStrip;
		case triangles:
			return Mode.Triangles;
		default:
			throw new IllegalArgumentException(String.format("doesn't support %s : %s",v==null?"?":v.getClass(),v));
	}
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:17,代码来源:PrimitiveExt.java


示例6: fromLoop

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public static Mesh fromLoop( Loop<Point3d> in ) {

		if ( !in.holes.isEmpty() ) {
			LoopL<Point3d> res =new LoopL<Point3d>( in );
			in = res.isEmpty() ? in : res.get( 0 );
		}

		Mesh m = new Mesh();

		m.setMode( Mesh.Mode.Triangles );

		List<Integer> inds = new ArrayList<>();
		List<Float> pos = new ArrayList<>();
		List<Float> norms = new ArrayList<>();

		Loopz.triangulate( in, false, inds, pos, norms );

		m.setBuffer( Type.Index, 3, Arrayz.toIntArray( inds ) );
		m.setBuffer( Type.Position, 3, Arrayz.toFloatArray( pos ) );
		m.setBuffer( Type.Normal, 3, Arrayz.toFloatArray( norms ) );

		return m;
	}
 
开发者ID:twak,项目名称:siteplan,代码行数:24,代码来源:Jme3z.java


示例7: convertElementMode

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
/*********************************************************************\
 |* Render Calls                                                      *|
 \*********************************************************************/
public int convertElementMode(Mode mode) {
    switch (mode) {
        case Points:
            return GL20.GL_POINTS;
        case Lines:
            return GL20.GL_LINES;
        case LineLoop:
            return GL20.GL_LINE_LOOP;
        case LineStrip:
            return GL20.GL_LINE_STRIP;
        case Triangles:
            return GL20.GL_TRIANGLES;
        case TriangleFan:
            return GL20.GL_TRIANGLE_FAN;
        case TriangleStrip:
            return GL20.GL_TRIANGLE_STRIP;
        default:
            throw new UnsupportedOperationException("Unrecognized mesh mode: " + mode);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:24,代码来源:GdxRenderer.java


示例8: convertElementMode

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
private int convertElementMode(Mesh.Mode mode) {
    switch (mode) {
        case Points:
            return gl.GL_POINTS;
        case Lines:
            return gl.GL_LINES;
        case LineLoop:
            return gl.GL_LINE_LOOP;
        case LineStrip:
            return gl.GL_LINE_STRIP;
        case Triangles:
            return gl.GL_TRIANGLES;
        case TriangleFan:
            return gl.GL_TRIANGLE_FAN;
        case TriangleStrip:
            return gl.GL_TRIANGLE_STRIP;
        default:
            throw new UnsupportedOperationException("Unrecognized mesh mode: " + mode);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:21,代码来源:JoglRenderer.java


示例9: convertElementMode

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
/*********************************************************************\
|* Render Calls                                                      *|
\*********************************************************************/
public int convertElementMode(Mesh.Mode mode) {
    switch (mode) {
        case Points:
            return GLES20.GL_POINTS;
        case Lines:
            return GLES20.GL_LINES;
        case LineLoop:
            return GLES20.GL_LINE_LOOP;
        case LineStrip:
            return GLES20.GL_LINE_STRIP;
        case Triangles:
            return GLES20.GL_TRIANGLES;
        case TriangleFan:
            return GLES20.GL_TRIANGLE_FAN;
        case TriangleStrip:
            return GLES20.GL_TRIANGLE_STRIP;
        default:
            throw new UnsupportedOperationException("Unrecognized mesh mode: " + mode);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:24,代码来源:OGLESShaderRenderer.java


示例10: convertElementMode

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
@Override
protected int convertElementMode(Mesh.Mode mode) {
    switch (mode) {
        case Points:
            return GL.GL_POINTS;
        case Lines:
            return GL.GL_LINES;
        case LineLoop:
            return GL.GL_LINE_LOOP;
        case LineStrip:
            return GL.GL_LINE_STRIP;
        case Triangles:
            return GL.GL_TRIANGLES;
        case TriangleFan:
            return GL.GL_TRIANGLE_FAN;
        case TriangleStrip:
            return GL.GL_TRIANGLE_STRIP;
        default:
            throw new UnsupportedOperationException("Unrecognized mesh mode: " + mode);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:22,代码来源:JoglRenderer.java


示例11: calculate

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
@Override
public void calculate() {

	for (Spatial s : gNode.getChildren())
		s.removeFromParent();
	
	Mesh mesh = new Mesh();
	mesh.setMode( Mode.Points );
	
	Vector3f[] verts = new Vector3f[cubes.size()];
	
	for (int i = 0; i < cubes.size(); i++) {
		verts[ i ] = new com.jme3.math.Vector3f( (float)cubes.get( i ).x, (float)cubes.get( i ).y, (float)cubes.get( i ).z );
	}
	
	mesh.setBuffer( VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer( verts ) );
	
	Material mat1 = new Material( tweed.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md" );
	mat1.setBoolean( "VertexColor", true );
	Geometry depth = new Geometry( "depth", mesh );
	depth.setMaterial( mat1 );
	
	depth.updateModelBound();
	depth.updateGeometricState();
	
	gNode.attachChild(depth);
	
	super.calculate();
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:30,代码来源:DebugGen.java


示例12: addCubes

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
private void addCubes (List<float[]> cubes) {
	tweed.enqueue( new Runnable() {
		public void run() {
			
			Mesh mesh = new Mesh();
			mesh.setMode( Mode.Points );
			
			Vector3f[] verts = new Vector3f[cubes.size()];
			Vector4f[] cols  = new Vector4f[cubes.size()];
			
			for (int i = 0; i < cubes.size(); i++) {
				verts[ i ] = new com.jme3.math.Vector3f( cubes.get( i )[ 0 ], cubes.get( i )[ 1 ], cubes.get( i )[ 2 ] );
				cols[i] = new Vector4f( cubes.get( i )[ 3 ], cubes.get( i )[ 4 ], cubes.get( i )[ 5 ], 1 );
			}
			
			mesh.setBuffer( VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer( verts ) );
			mesh.setBuffer( VertexBuffer.Type.Color   , 4, BufferUtils.createFloatBuffer( cols  ) );
			
			Material mat1 = new Material( tweed.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md" );
			mat1.setBoolean( "VertexColor", true );
			Geometry depth = new Geometry( "depth", mesh );
			depth.setMaterial( mat1 );
			
			depth.updateModelBound();
			depth.updateGeometricState();
			
			
			tweed.frame.addGen( new JmeGen( "depth", tweed, depth ), true );
		}
	} );
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:32,代码来源:PanoGen.java


示例13: createTriangleStripMesh

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
private Mesh createTriangleStripMesh() {
      Mesh strip = new Mesh();
      strip.setMode(Mode.TriangleStrip);
      FloatBuffer vb = BufferUtils.createFloatBuffer(3*3*3); // 3 rows * 3 columns * 3 floats
      vb.rewind();
      vb.put(new float[]{0,2,0}); vb.put(new float[]{1,2,0}); vb.put(new float[]{2,2,0});
      vb.put(new float[]{0,1,0}); vb.put(new float[]{1,1,0}); vb.put(new float[]{2,1,0});
      vb.put(new float[]{0,0,0}); vb.put(new float[]{1,0,0}); vb.put(new float[]{2,0,0});
      FloatBuffer nb = BufferUtils.createFloatBuffer(3*3*3);
      nb.rewind();
      nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1});
      nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1});
      nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1});
      FloatBuffer tb = BufferUtils.createFloatBuffer(3*3*2);
      tb.rewind();
      tb.put(new float[]{0,0}); tb.put(new float[]{0.5f,0}); tb.put(new float[]{1,0});
      tb.put(new float[]{0,0.5f}); tb.put(new float[]{0.5f,0.5f}); tb.put(new float[]{1,0.5f});
      tb.put(new float[]{0,1}); tb.put(new float[]{0.5f,1}); tb.put(new float[]{1,1});
      int[] indexes = new int[]{0,3,1,4,2,5, 5,3, 3,6,4,7,5,8};
      IntBuffer ib = BufferUtils.createIntBuffer(indexes.length);
      ib.put(indexes);
      strip.setBuffer(Type.Position, 3, vb);
strip.setBuffer(Type.Normal, 3, nb);
strip.setBuffer(Type.TexCoord, 2, tb);
strip.setBuffer(Type.Index, 3, ib);
      strip.updateBound();
      return strip;
  }
 
开发者ID:mleoking,项目名称:PhET,代码行数:29,代码来源:TestTangentGen.java


示例14: createMesh

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public Mesh createMesh(Vector3f scale, Vector2f tcScale, Vector2f tcOffset, float offsetAmount, int totalSize, boolean center, int lod, boolean rightLod, boolean topLod, boolean leftLod, boolean bottomLod) {
    FloatBuffer pb = writeVertexArray(null, scale, center);
    FloatBuffer tb = writeTexCoordArray(null, tcOffset, tcScale, offsetAmount, totalSize);
    FloatBuffer nb = writeNormalArray(null, scale);
    IntBuffer ib = writeIndexArrayLodDiff(null, lod, rightLod, topLod, leftLod, bottomLod);
    Mesh m = new Mesh();
    m.setMode(Mode.TriangleStrip);
    m.setBuffer(Type.Position, 3, pb);
    m.setBuffer(Type.Normal, 3, nb);
    m.setBuffer(Type.TexCoord, 2, tb);
    m.setBuffer(Type.Index, 3, ib);
    m.setStatic();
    m.updateBound();
    return m;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:LODGeomap.java


示例15: drawTriangleArray

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public void drawTriangleArray(Mesh.Mode mode, int count, int vertCount) {
    if (count > 1) {
        ARBDrawInstanced.glDrawArraysInstancedARB(convertElementMode(mode), 0,
                vertCount, count);
    } else {
        glDrawArrays(convertElementMode(mode), 0, vertCount);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:LwjglRenderer.java


示例16: drawTriangleArray

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public void drawTriangleArray(Mesh.Mode mode, int count, int vertCount) {
    if (count > 1) {
        throw new UnsupportedOperationException();
    }

    glDrawArrays(convertElementMode(mode), 0, vertCount);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:LwjglGL1Renderer.java


示例17: drawTriangleList

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public void drawTriangleList(VertexBuffer indexBuf, Mesh mesh, int count) {
    Mesh.Mode mode = mesh.getMode();

    Buffer indexData = indexBuf.getData();
    indexData.rewind();

    if (mesh.getMode() == Mode.Hybrid) {
        throw new UnsupportedOperationException();
        /*
        int[] modeStart = mesh.getModeStart();
        int[] elementLengths = mesh.getElementLengths();
        
        int elMode = convertElementMode(Mode.Triangles);
        int fmt = convertVertexFormat(indexBuf.getFormat());
        //            int elSize = indexBuf.getFormat().getComponentSize();
        //            int listStart = modeStart[0];
        int stripStart = modeStart[1];
        int fanStart = modeStart[2];
        int curOffset = 0;
        for (int i = 0; i < elementLengths.length; i++) {
        if (i == stripStart) {
        elMode = convertElementMode(Mode.TriangleStrip);
        } else if (i == fanStart) {
        elMode = convertElementMode(Mode.TriangleStrip);
        }
        int elementLength = elementLengths[i];
        indexData.position(curOffset);
        
        drawElements(elMode,
        fmt,
        indexData);
        
        curOffset += elementLength;
        }*/
    } else {
        drawElements(convertElementMode(mode),
                convertVertexFormat(indexBuf.getFormat()),
                indexData);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:41,代码来源:LwjglGL1Renderer.java


示例18: convertToList

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public static void convertToList(Mesh mesh){
    IndexBuffer inBuf = mesh.getIndicesAsList();
    IndexBuffer outBuf = IndexBuffer.createIndexBuffer(mesh.getVertexCount(),
                                                       inBuf.size());

    for (int i = 0; i < inBuf.size(); i++){
        outBuf.put(i, inBuf.get(i));
    }

    mesh.clearBuffer(Type.Index);
    switch (mesh.getMode()){
        case LineLoop:
        case LineStrip:
            mesh.setMode(Mode.Lines);
            break;
        case TriangleStrip:
        case TriangleFan:
            mesh.setMode(Mode.Triangles);
            break;
        default:
            break;
    }
    if (outBuf instanceof IndexIntBuffer){
        mesh.setBuffer(Type.Index, 3, (IntBuffer)outBuf.getBuffer());
    }else{
        mesh.setBuffer(Type.Index, 3, (ShortBuffer)outBuf.getBuffer());
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:29,代码来源:WrappedIndexBuffer.java


示例19: VirtualIndexBuffer

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public VirtualIndexBuffer(int numVerts, Mode meshMode){
    this.numVerts = numVerts;
    this.meshMode = meshMode;
    switch (meshMode) {
        case Points:
            numIndices = numVerts;
            return;
        case LineLoop:
            numIndices = (numVerts - 1) * 2 + 1;
            return;
        case LineStrip:
            numIndices = (numVerts - 1) * 2;
            return;
        case Lines:
            numIndices = numVerts;
            return;
        case TriangleFan:
            numIndices = (numVerts - 2) * 3;
            return;
        case TriangleStrip:
            numIndices = (numVerts - 2) * 3;
            return;
        case Triangles:
            numIndices = numVerts;
            return;
        case Hybrid:
            throw new UnsupportedOperationException();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:30,代码来源:VirtualIndexBuffer.java


示例20: drawTriangleArray

import com.jme3.scene.Mesh.Mode; //导入依赖的package包/类
public void drawTriangleArray(Mode mode, int count, int vertCount) {
    /*        if (count > 1){
    ARBDrawInstanced.glDrawArraysInstancedARB(convertElementMode(mode), 0,
    vertCount, count);
    }else{*/
    if (verboseLogging) {
        logger.info("GLES20.glDrawArrays(" + vertCount + ")");
    }

    Gdx.gl20.glDrawArrays(convertElementMode(mode), 0, vertCount);
    /*
    }*/
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:14,代码来源:GdxRenderer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextBuilder类代码示例发布时间:2022-05-23
下一篇:
Java Registry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap