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


Java ModelLoader.loadModel方法代码示例

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


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

示例1: create

import com.badlogic.gdx.assets.loaders.ModelLoader; //导入方法依赖的package包/类
@Override
public void create () {
	super.create();

	ModelLoader g3djLoader = new G3dModelLoader(new JsonReader());
	model = g3djLoader.loadModel(Gdx.files.internal("data/g3d/btscene1.g3dj"));
	disposables.add(model);

	importer = new MyImporter((btDynamicsWorld)world.collisionWorld);
	importer.loadFile(Gdx.files.internal("data/g3d/btscene1.bullet"));

	camera.position.set(10f, 15f, 20f);
	camera.up.set(0, 1, 0);
	camera.lookAt(-10, 8, 0);
	camera.update();
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:17,代码来源:ImportTest.java

示例2: loadSphere

import com.badlogic.gdx.assets.loaders.ModelLoader; //导入方法依赖的package包/类
private void loadSphere(String planetId) {
	ModelLoader loader = new ObjLoader();
	sphereModel = loader.loadModel(Gdx.files.internal("models/sphere01.obj"),
			new SphereTextureProvider(planetId));
	environmentSphere = new ModelInstance(sphereModel);
	Attribute attribute = environmentSphere.materials.get(0).get(
			ColorAttribute.getAttributeType(ColorAttribute.DiffuseAlias));

	((ColorAttribute) attribute).color.r = 1;
	((ColorAttribute) attribute).color.g = 1;
	((ColorAttribute) attribute).color.b = 1;

}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:14,代码来源:ControllerPlanet.java

示例3: onInitialize

import com.badlogic.gdx.assets.loaders.ModelLoader; //导入方法依赖的package包/类
@Override
protected void onInitialize() {
  this.levelEnv          = new LevelEnv();
  this.camera            = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  camera.near = 0.1f;
  camera.position.set(5, 5, 5);
  camera.lookAt(0.1f, 0.1f, 0.1f);

  environment = new Environment();
  environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
  environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -0.5f, -1.0f, -0.8f));


  this.modelBatch        = new ModelBatch();
  //this.voxelBatch        = new VoxelBatch(new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED)));
  ModelLoader g3djLoader = new G3dModelLoader(new UBJsonReader());
  model                  = g3djLoader.loadModel(ForgE.files.internal("raw/models/test.g3db"));

  modelInstance          = new ModelInstance(model);

  modelInstance.calculateBoundingBox(bounds);
  camera.position.set(1, 1, 1).nor().scl(bounds.getDimensions(tmpV1).len() * 1.75f + bounds.getCenter(tmpV2).len());
  camera.up.set(0, 1, 0);
  camera.lookAt(0, 0, 0);
  camera.far = 50f + bounds.getDimensions(tmpV1).len() * 3.0f;
  camera.update(true);
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:28,代码来源:TestModelsScreen.java

示例4: Rocket

import com.badlogic.gdx.assets.loaders.ModelLoader; //导入方法依赖的package包/类
public Rocket() {
	// init graphic
	ModelLoader loader = new ObjLoader();
	model = loader.loadModel(Gdx.files.internal("models/rocket.obj"), new ObjLoader.ObjLoaderParameters(true));
	rocketModelInstance = new ModelInstance(model);


	ModelBuilder modelBuilder = new ModelBuilder();
	final long attributes = VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal;

	// damage shield
	Material shieldMaterial = new Material();
	shieldMaterial.set(ColorAttribute.createDiffuse(0, 0.3f, 1, 0.5f));
	shieldMaterial.set(ColorAttribute.createSpecular(1, 1, 1, 1f));
	shieldMaterial.set(new BlendingAttribute(1f));
	Model shieldModel = modelBuilder.createSphere(4, 4, 4, 32, 32, shieldMaterial, attributes);
	shieldModelInstance = new ModelInstance(shieldModel);

	Material tractorBeamMaterial = new Material();
	tractorBeamMaterial.set(ColorAttribute.createDiffuse(0, 0, 1, 1));
	tractorBeamMaterial.set(ColorAttribute.createSpecular(1, 1, 1, 1f));
	tractorBeamMaterial.set(new BlendingAttribute(0.1f));
	Model tractorBeamModel = modelBuilder.createSphere(5, 5, 5, 32, 32, tractorBeamMaterial, attributes);
	tractorBeamModelInstance = new ModelInstance(tractorBeamModel);


	// init physic
	//BoundingBox boundingBox = new BoundingBox();
	//model.calculateBoundingBox(boundingBox);
	//btCollisionShape shape = new btBoxShape(boundingBox.getDimensions(new Vector3()).scl(0.5f));
	btCollisionShape shape = new btBoxShape(new Vector3(1, 1, 1));

	rocketModelInstance.transform.setToRotation(0, 0, 1, 0);
	rocketModelInstance.transform.trn(START_POSITION);
	float mass = 1;
	addRigidBody(shape, mass, SpaceShipProperties.properties.getLandslide(), CollisionTypes.ROCKET.mask,
			new RocketMotionState(rocketModelInstance.transform));
	rigidBodyList.get(0).setActivationState(4); // disable deactivation
	rigidBodyList.get(0).setLinearVelocity(tmpMovement.set(getDirection()).nor().scl(
			SpaceShipProperties.properties.getEnginePower()));

	thrustSound = App.audioController.getSound("thrust.wav");
	if (App.config.playAudio) {
		thrustSound.loop();
		thrustSound.play();
	}
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:48,代码来源:Rocket.java


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