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

Java Node类代码示例

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

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



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

示例1: init

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
private void init() {
	float centerX = 0f;
	float centerY = ((((float) words.length) * FONT_HEIGHT) - FONT_HEIGHT) / 2f;
	
	nodes.clear();
	nodesPosition = new Array<Vector3>();
	if(words != null && words.length > 0){
		for(int y = 0; y < words.length; y++){
			String[] word = translateSpecialCharacters(words[y]);
			centerX = (((float) word.length) * FONT_WIDTH) / 2f;
			for(int x = 0; x < word.length; x++){
				String letter = String.valueOf(word[x]);
				
				Node node = model.getNode(letter);
				if(node != null){
					Vector3 position = new Vector3((FONT_WIDTH*x) - centerX,(-FONT_HEIGHT*y) + centerY,0);
					node = node.copy();
					node.globalTransform.setTranslation(position);
					nodes.add(node);
					nodesPosition.add(position.cpy());
				}
			}
		}
	}
}
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:26,代码来源:Word.java


示例2: NodeComponent

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
public NodeComponent() {
    node = new Node();

    tempVec = new Vector3();
    tempVec2 = new Vector3();
    tempQuat = new Quaternion();

    translation = new Vector3();
    rotation = new Vector3();
    scale = new Vector3(1, 1, 1);
    
    localTranslation = new Vector3();
    localRotation = new Vector3();
    localScale = new Vector3(1, 1, 1);

    translationDelta = new Vector3();
    rotationDelta = new Vector3();
    scaleDelta = new Vector3();

    localRotationQuaternion = new Quaternion();
    rotationQuaternion = new Quaternion();
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:23,代码来源:NodeComponent.java


示例3: updateBodiesToArmature

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/**
 * Updates the rigid body parts to follow nodes of the model instance
 */
private void updateBodiesToArmature() {
	// Ragdoll parts should follow the model animation.
	// Loop over each part and set it to the global transform of the armature node it should follow.
	capsuleTransform.set(modelTransform);
	for (Iterator<ObjectMap.Entry<btRigidBody, RigidBodyNodeConnection>> iterator
		 = bodyPartMap.iterator(); iterator.hasNext(); ) {
		ObjectMap.Entry<btRigidBody, RigidBodyNodeConnection> entry = iterator.next();
		RigidBodyNodeConnection data = entry.value;
		btRigidBody body = entry.key;
		Node followNode = data.followNode;
		Vector3 offset = data.bodyNodeOffsets.get(followNode);

		body.proceedToTransform(tmpMatrix.set(capsuleTransform)
				.mul(followNode.globalTransform).translate(offset));
	}
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:20,代码来源:Ragdoll.java


示例4: addPart

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/**
 * @param bodyPart The rigid body which is to be synchronized with a node
 * @param node     The node which is to be synchronized with a body
 */
private void addPart(btRigidBody bodyPart, Node node) {
	if (!bodyPartMap.containsKey(bodyPart)) {
		bodyPartMap.put(bodyPart, new RigidBodyNodeConnection());
	}
	RigidBodyNodeConnection conn = bodyPartMap.get(bodyPart);
	conn.followNode = node;
	// Set the follow offset to the middle of the armature bone
	Vector3 offsetTranslation = new Vector3();
	node.getChild(0).localTransform.getTranslation(offsetTranslation).scl(0.5f);
	conn.bodyNodeOffsets.put(node, offsetTranslation);

	if (!ragdollMappedNodes.contains(node, true)) {
		ragdollMappedNodes.add(node);
	}
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:20,代码来源:Ragdoll.java


示例5: setNavmesh

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/**
 * Creates and adds the navmesh to this scene.
 */
private void setNavmesh(GameObjectBlueprint bp) {
	// We need to set the node transforms before calculating the navmesh shape
	GameModel gameModel = new GameModel(bp.model, bp.name, bp.position, bp.rotation, bp.scale);

	Array<NodePart> nodes = gameModel.modelInstance.model.getNode("navmesh").parts;
	// Sort the model meshParts array according to material name
	nodes.sort(new NavMeshNodeSorter());

	// The model transform must be applied to the meshparts for shape generation to work correctly.
	gameModel.modelInstance.calculateTransforms();
	Matrix4 transform = new Matrix4();
	for (Node node : gameModel.modelInstance.nodes) {
		transform.set(node.globalTransform).inv();
		for (NodePart nodePart : node.parts) {
			nodePart.meshPart.mesh.transform(transform);
		}
	}
	navMesh = new NavMesh(gameModel.modelInstance.model);
	btCollisionShape shape = navMesh.getShape();

	navmeshBody = new InvisibleBody("navmesh",
			shape, 0, gameModel.modelInstance.transform, GameEngine.NAVMESH_FLAG, GameEngine.NAVMESH_FLAG, false, false);
	worldBounds.set(gameModel.boundingBox);
	gameModel.dispose();
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:29,代码来源:GameScene.java


示例6: drawArmatureNodes

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
private void drawArmatureNodes(Node currentNode, Vector3 modelPos,
							   Quaternion modelRot,
							   Vector3 parentNodePos, Vector3 currentNodePos) {
	currentNode.globalTransform.getTranslation(currentNodePos);
	modelRot.transform(currentNodePos);
	currentNodePos.add(modelPos);
	drawVertex(currentNodePos, 0.02f, Color.GREEN);
	shapeRenderer.setColor(Color.YELLOW);
	if (currentNode.hasParent()) {
		shapeRenderer.line(parentNodePos, currentNodePos);
	}
	if (currentNode.hasChildren()) {
		float x = currentNodePos.x;
		float y = currentNodePos.y;
		float z = currentNodePos.z;
		for (Node child : currentNode.getChildren()) {
			drawArmatureNodes(child, modelPos, modelRot, currentNodePos, parentNodePos);
			currentNodePos.set(x, y, z);
		}
	}
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:22,代码来源:ArmatureDebugDrawer.java


示例7: createFromMesh

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
@Deprecated
public static Model createFromMesh (final Mesh mesh, int indexOffset, int vertexCount, int primitiveType,
	final Material material) {
	Model result = new Model();
	MeshPart meshPart = new MeshPart();
	meshPart.id = "part1";
	meshPart.indexOffset = indexOffset;
	meshPart.numVertices = vertexCount;
	meshPart.primitiveType = primitiveType;
	meshPart.mesh = mesh;

	NodePart partMaterial = new NodePart();
	partMaterial.material = material;
	partMaterial.meshPart = meshPart;
	Node node = new Node();
	node.id = "node1";
	node.parts.add(partMaterial);

	result.meshes.add(mesh);
	result.materials.add(material);
	result.nodes.add(node);
	result.meshParts.add(meshPart);
	result.manageDisposable(mesh);
	return result;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:26,代码来源:ModelBuilder.java


示例8: createXYZCoordinates

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/** Convenience method to create a model with three orthonormal vectors shapes. The resources the Material might contain are not
 * managed, use {@link Model#manageDisposable(Disposable)} to add those to the model.
 * @param axisLength Length of each axis.
 * @param capLength is the height of the cap in percentage, must be in (0,1)
 * @param stemThickness is the percentage of stem diameter compared to cap diameter, must be in (0,1]
 * @param divisions the amount of vertices used to generate the cap and stem ellipsoidal bases */
public Model createXYZCoordinates (float axisLength, float capLength, float stemThickness, int divisions, int primitiveType,
	Material material, long attributes) {
	begin();
	MeshPartBuilder partBuilder;
	Node node = node();

	partBuilder = part("xyz", primitiveType, attributes, material);
	partBuilder.setColor(Color.RED);
	partBuilder.arrow(0, 0, 0, axisLength, 0, 0, capLength, stemThickness, divisions);
	partBuilder.setColor(Color.GREEN);
	partBuilder.arrow(0, 0, 0, 0, axisLength, 0, capLength, stemThickness, divisions);
	partBuilder.setColor(Color.BLUE);
	partBuilder.arrow(0, 0, 0, 0, 0, axisLength, capLength, stemThickness, divisions);

	return end();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:23,代码来源:ModelBuilder.java


示例9: loadAnimations

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
private void loadAnimations (Iterable<ModelAnimation> modelAnimations) {
	for (final ModelAnimation anim : modelAnimations) {
		Animation animation = new Animation();
		animation.id = anim.id;
		for (ModelNodeAnimation nanim : anim.nodeAnimations) {
			final Node node = getNode(nanim.nodeId);
			if (node == null) continue;
			NodeAnimation nodeAnim = new NodeAnimation();
			nodeAnim.node = node;
			for (ModelNodeKeyframe kf : nanim.keyframes) {
				if (kf.keytime > animation.duration) animation.duration = kf.keytime;
				NodeKeyframe keyframe = new NodeKeyframe();
				keyframe.keytime = kf.keytime;
				keyframe.rotation.set(kf.rotation == null ? node.rotation : kf.rotation);
				keyframe.scale.set(kf.scale == null ? node.scale : kf.scale);
				keyframe.translation.set(kf.translation == null ? node.translation : kf.translation);
				nodeAnim.keyframes.add(keyframe);
			}
			if (nodeAnim.keyframes.size > 0) animation.nodeAnimations.add(nodeAnim);
		}
		if (animation.nodeAnimations.size > 0) animations.add(animation);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:24,代码来源:Model.java


示例10: ModelInstance

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/** @param model The source {@link Model}
 * @param transform The {@link Matrix4} instance for this ModelInstance to reference or null to create a new matrix.
 * @param nodeId The ID of the {@link Node} within the {@link Model} for the instance to contain
 * @param recursive True to recursively search the Model's node tree, false to only search for a root node
 * @param parentTransform True to apply the parent's node transform to the instance (only applicable if recursive is true).
 * @param mergeTransform True to apply the source node transform to the instance transform, resetting the node transform. */
public ModelInstance (final Model model, final Matrix4 transform, final String nodeId, boolean recursive,
	boolean parentTransform, boolean mergeTransform, boolean shareKeyframes) {
	this.model = model;
	this.transform = transform == null ? new Matrix4() : transform;
	nodePartBones.clear();
	Node copy, node = model.getNode(nodeId, recursive);
	this.nodes.add(copy = copyNode(node));
	if (mergeTransform) {
		this.transform.mul(parentTransform ? node.globalTransform : node.localTransform);
		copy.translation.set(0, 0, 0);
		copy.rotation.idt();
		copy.scale.set(1, 1, 1);
	} else if (parentTransform && copy.hasParent()) this.transform.mul(node.getParent().globalTransform);
	setBones();
	copyAnimations(model.animations, shareKeyframes);
	calculateTransforms();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:24,代码来源:ModelInstance.java


示例11: copyNode

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
private Node copyNode (Node node) {
	Node copy = new Node();
	copy.id = node.id;
	copy.inheritTransform = node.inheritTransform;
	copy.translation.set(node.translation);
	copy.rotation.set(node.rotation);
	copy.scale.set(node.scale);
	copy.localTransform.set(node.localTransform);
	copy.globalTransform.set(node.globalTransform);
	for (NodePart nodePart : node.parts) {
		copy.parts.add(copyNodePart(nodePart));
	}
	for (Node child : node.getChildren()) {
		copy.addChild(copyNode(child));
	}
	return copy;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:ModelInstance.java


示例12: createFromMesh

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
@Deprecated
public static Model createFromMesh(final Mesh mesh, int indexOffset, int vertexCount, int primitiveType, final Material material) {
    Model result = new Model();
    MeshPart meshPart = new MeshPart();
    meshPart.id = "part1";
    meshPart.offset = indexOffset;
    meshPart.size = vertexCount;
    meshPart.primitiveType = primitiveType;
    meshPart.mesh = mesh;

    NodePart partMaterial = new NodePart();
    partMaterial.material = material;
    partMaterial.meshPart = meshPart;
    Node node = new Node();
    node.id = "node1";
    node.parts.add(partMaterial);

    result.meshes.add(mesh);
    result.materials.add(material);
    result.nodes.add(node);
    result.meshParts.add(meshPart);
    result.manageDisposable(mesh);
    return result;
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:25,代码来源:ModelBuilder2.java


示例13: createPlayerModel

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/** players are represented by cubes, with another cube marking the direction it is facing */
public void createPlayerModel() {
	ModelBuilder mb = new ModelBuilder();
	ModelBuilder mb2 = new ModelBuilder();
	long attr = Usage.Position | Usage.Normal;
	float r = 0.5f;
	float g = 1f;
	float b = 0.75f;
	Material material = new Material(ColorAttribute.createDiffuse(new Color(r, g, b, 1f)));
	Material faceMaterial = new Material(ColorAttribute.createDiffuse(Color.BLUE));
	float w = 1f;
	float d = w;
	float h = 2f;
	mb.begin();
	//playerModel = mb.createBox(w, h, d, material, attr);
	Node node = mb.node("box", mb2.createBox(w, h, d, material, attr));
	// the face is just a box to show which direction the player is facing
	Node faceNode = mb.node("face", mb2.createBox(w/2, h/2, d/2, faceMaterial, attr));
	faceNode.translation.set(0f, 0f, d/2);
	playerModel = mb.end();
}
 
开发者ID:jrenner,项目名称:gdx-proto,代码行数:22,代码来源:ModelManager.java


示例14: buildStatics

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/** client builds statics, probably based on info from server */
public static void buildStatics(LevelStatic[] statics) {
	if (staticGeometry == null) {
		staticGeometry = new Array<>();
	}
	Log.debug("client building statics received from server: " + statics.length);
	ModelBuilder mb = new ModelBuilder();
	mb.begin();
	for (LevelStatic stat : statics) {
		Model model = Assets.manager.get(stat.modelName, Model.class);
		setupStaticModel(model.meshParts, stat.mtx, true);
		Node node = mb.node("piece", model);
		stat.mtx.getTranslation(tmp);
		node.translation.set(tmp);
		node.rotation.set(stat.mtx.getRotation(q));
	}
	Model finalModel = mb.end();
	ModelInstance instance = new ModelInstance(finalModel);
	staticGeometry.add(instance);
}
 
开发者ID:jrenner,项目名称:gdx-proto,代码行数:21,代码来源:LevelBuilder.java


示例15: SharedModel

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
/** @param model The source {@link Model}
 * @param transform The {@link Matrix4} instance for this ModelInstance to reference or null to create a new matrix. 
 * @param nodeId The ID of the {@link Node} within the {@link Model} for the instance to contain
 * @param recursive True to recursively search the Model's node tree, false to only search for a root node
 * @param parentTransform True to apply the parent's node transform to the instance (only applicable if recursive is true).
 * @param mergeTransform True to apply the source node transform to the instance transform, resetting the node transform. */
public SharedModel(final Model model, final Matrix4 transform, final String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform) {
	this.model = model;
	this.transform = transform == null ? new Matrix4() : transform; 
	nodePartBones.clear();
	Node copy, node = model.getNode(nodeId, recursive);
	this.nodes.add(copy = copyNode(null, node));
	if (mergeTransform) {
		this.transform.mul(parentTransform ? node.globalTransform : node.localTransform);
		copy.translation.set(0,0,0);
		copy.rotation.idt();
		copy.scale.set(1,1,1);
	} else if (parentTransform && copy.parent != null)
		this.transform.mul(node.parent.globalTransform);
	setBones();
	copyAnimations(model.animations);
	calculateTransforms();
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:24,代码来源:SharedModel.java


示例16: copyNode

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
private Node copyNode(Node parent, Node node) {
	Node copy = new Node();
	copy.id = node.id;
	//copy.boneId = node.boneId;
	copy.parent = parent;
	copy.translation.set(node.translation);
	copy.rotation.set(node.rotation);
	copy.scale.set(node.scale);
	copy.localTransform.set(node.localTransform);
	copy.globalTransform.set(node.globalTransform);
	for(NodePart nodePart: node.parts) {
		copy.parts.add(copyNodePart(nodePart));
	}
	for(Node child: node.children) {
		copy.children.add(copyNode(copy, child));
	}
	return copy;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:19,代码来源:SharedModel.java


示例17: copyAnimations

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
private void copyAnimations (final Iterable<Animation> source) {
	for (final Animation anim : source) {
		Animation animation = new Animation();
		animation.id = anim.id;
		animation.duration = anim.duration;
		for (final NodeAnimation nanim : anim.nodeAnimations) {
			final Node node = getNode(nanim.node.id);
			if (node == null)
				continue;
			NodeAnimation nodeAnim = new NodeAnimation();
			nodeAnim.node = node;
			for (final NodeKeyframe kf : nanim.keyframes) {
				NodeKeyframe keyframe = new NodeKeyframe();
				keyframe.keytime = kf.keytime;
				keyframe.rotation.set(kf.rotation);
				keyframe.scale.set(kf.scale);
				keyframe.translation.set(kf.translation);
				nodeAnim.keyframes.add(keyframe);
			}
			if (nodeAnim.keyframes.size > 0)
				animation.nodeAnimations.add(nodeAnim);
		}
		if (animation.nodeAnimations.size > 0)
			animations.add(animation);
	}
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:27,代码来源:SharedModel.java


示例18: doneLoading

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
private void doneLoading() {
	Model model = assets.get("data/g3d/test.g3db", Model.class);
	for (int i = 0; i < model.nodes.size; i++) {
		Node node = model.nodes.get(i);
		log.debug("loader node " + node.id);

		if (node.id.equals("test_root")) {
			node = node.getChild("Building", false, false);
			log.debug("loader node " + node.id);

			node.rotation.setFromAxis(1, 0, 0, 90);
			mModel = model;

			break;
		}

		//}
	}

	loading = false;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:22,代码来源:GdxModelLayer.java


示例19: collectModelNodeVertexPositions

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
protected void collectModelNodeVertexPositions(Node node, Array<Vector3> destVertices, Vector3 scaleFactor, Vector3 positionOffset) {
	final Matrix4 transform = node.globalTransform;

	for (int i = 0; i < node.parts.size; ++i) {
		NodePart nodePart = node.parts.get(i);
		MeshPart meshPart = nodePart.meshPart;
		ShortBuffer indices = meshPart.mesh.getIndicesBuffer();
		FloatBuffer vertices = meshPart.mesh.getVerticesBuffer();
		final int strideInFloats = meshPart.mesh.getVertexSize() / (Float.SIZE / 8);

		for (int j = 0; j < meshPart.numVertices; ++j) {
			int index = indices.get(meshPart.indexOffset + j);
			int offset = index * strideInFloats;

			tmpPosition.set(vertices.get(offset), vertices.get(offset + 1), vertices.get(offset + 2))
			           .add(positionOffset)
			           .scl(scaleFactor)
			           .mul(transform);
			destVertices.add(new Vector3(tmpPosition));
		}
	}

	for (int i = 0; i < node.children.size; ++i)
		collectModelNodeVertexPositions(node.children.get(i), destVertices, scaleFactor, positionOffset);
}
 
开发者ID:gered,项目名称:gdx-tilemap3d,代码行数:26,代码来源:BaseModelTileMesh.java


示例20: Gun

import com.badlogic.gdx.graphics.g3d.model.Node; //导入依赖的package包/类
public Gun(Matrix4 transform, int hp, int health, int range, float cooldown, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance instance, btCollisionShape shape, btCollisionWorld world, IntMap<Entity> entities, String attack, EntityTemplate<Bullet> projectile, Vector3 attackOffset, Map<String, Sound> sounds) {
    super(transform, hp, health, range, cooldown, types, effects, instance, shape, world, entities, attack, projectile, attackOffset, sounds);
    nodes = new HashMap<String, Node>();
    /*for(Node node: instance.model.nodes) {
        System.out.println(node.id);
        if (node.id.startsWith("Leg")) {
            legs.add(node);
        }
    }*/
    //legs.get(0).rotation.setEulerAngles(100, 0, 0);

    for(Node node: instance.getNode("Gun_root").getChildren())
        nodes.put(node.id, node);
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:15,代码来源:Gun.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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