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


Java G3dModelLoader类代码示例

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


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

示例1: SimulationRunner

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的package包/类
public SimulationRunner() {
    logger.info("Loading models");
    ModelBuilder builder = new ModelBuilder();
    models.put("box", builder.createBox(5f, 5f, 5f,
            new Material(ColorAttribute.createDiffuse(new Color(0.8f, 0f, 0f, 0f))),
            VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal));

    G3dModelLoader loader = new G3dModelLoader(new JsonReader());
    models.put("hub", loader.loadModel(Gdx.files.internal("data/hubreal.g3dj")));
    models.put("rim", loader.loadModel(Gdx.files.internal("data/rimreal.g3dj")));
    models.put("spoke", loader.loadModel(Gdx.files.internal("data/spoke.g3dj")));


    Bullet.init();
    logger.info("Initialized Bullet");
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:17,代码来源:SimulationRunner.java

示例2: create

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的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

示例3: AssetManager

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的package包/类
/** Creates a new AssetManager with all default loaders. */
public AssetManager (FileHandleResolver resolver) {
	setLoader(BitmapFont.class, new BitmapFontLoader(resolver));
	setLoader(Music.class, new MusicLoader(resolver));
	setLoader(Pixmap.class, new PixmapLoader(resolver));
	setLoader(Sound.class, new SoundLoader(resolver));
	setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver));
	setLoader(Texture.class, new TextureLoader(resolver));
	setLoader(Skin.class, new SkinLoader(resolver));
	setLoader(ParticleEffect.class, new ParticleEffectLoader(resolver));
	setLoader(PolygonRegion.class, new PolygonRegionLoader(resolver));
	setLoader(I18NBundle.class, new I18NBundleLoader(resolver));
	setLoader(Model.class, ".g3dj", new G3dModelLoader(new JsonReader(), resolver));
	setLoader(Model.class, ".g3db", new G3dModelLoader(new UBJsonReader(), resolver));
	setLoader(Model.class, ".obj", new ObjLoader(resolver));
	executor = new AsyncExecutor(1);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:AssetManager.java

示例4: createMeshes

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的package包/类
private void createMeshes() {
    ModelBuilder mb = new ModelBuilder();
    cubeModel = mb.createBox(1, 1, 1, new Material(),
            VertexAttributes.Usage.Position |
                    VertexAttributes.Usage.Normal |
                    VertexAttributes.Usage.TextureCoordinates);
    cubeMesh = cubeModel.meshes.first();

    G3dModelLoader modelLoader = new G3dModelLoader(new UBJsonReader());
    quadModel = modelLoader.loadModel(Gdx.files.internal("models/quad.g3db"));
    quadMesh = quadModel.meshes.first();
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:13,代码来源:LightProbe.java

示例5: onInitialize

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的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

示例6: ModelManager

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的package包/类
public ModelManager() {
  G3dModelLoader modelLoader = new G3dModelLoader(new UBJsonReader());
  this.robotModel            = modelLoader.loadModel(Gdx.files.getFileHandle("models/bot.g3db", Files.FileType.Internal));
  //TextureAttribute attr = (TextureAttribute) robotModel.materials.first().get(TextureAttribute.Diffuse);
  //attr.textureDescription.minFilter = Texture.TextureFilter.Nearest;
  //attr.textureDescription.magFilter = Texture.TextureFilter.Nearest;

  this.ledModel              = modelLoader.loadModel(Gdx.files.getFileHandle("models/led.g3db", Files.FileType.Internal));
}
 
开发者ID:macbury,项目名称:BotLogic,代码行数:10,代码来源:ModelManager.java

示例7: AssetRepository

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的package包/类
private AssetRepository() {
	repository = new HashMap<String, Object>();
	jsonReader = new UBJsonReader();
	modelLoader = new G3dModelLoader(jsonReader);
}
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:6,代码来源:AssetRepository.java

示例8: create

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的package包/类
@Override
public void create () {
	pbrShader=new PBRShader();
	pbrShader.init();

	pbrSadherTexture=new PBRSadherTexture();
	pbrSadherTexture.init();

	materials.put("Generic", null);
	materials.put("Rough Rock", createMaterial("roughrockface4"));
	materials.put("Bricks", createMaterial("mybricks3"));
	materials.put("Rusted Iron", createMaterial("rustediron-streaks"));
	materials.put("Carved Stone", createMaterial("carvedlimestoneground1"));
	materials.put("Grass", createMaterial("grass1"));
	materials.put("Floor", createMaterial("cavefloor1"));

	matNames = new ArrayList<String>(materials.keySet());

	actMaterial=matNames.indexOf("Generic");

	modelBatch = new ModelBatch();
	spriteBatch=new SpriteBatch();

	float w=Gdx.graphics.getWidth();
	float h=Gdx.graphics.getHeight();
	float scale=w/1600;

	cam=new PerspectiveCamera(30,w, h);
	cam.position.set(12,14,0);
	cam.lookAt(0,2,0);
	cam.up.set(0,1,0);
	cam.update();
	camController = new CameraInputController(cam);

	font = new BitmapFont(Gdx.files.internal("font/my_font.fnt"),
			Gdx.files.internal("font/my_font.png"), false);

	skin = new Skin(Gdx.files.internal("skin/uiskin.json"));

	CreateStage(w, h, scale);

	G3dModelLoader loader = new G3dModelLoader(new UBJsonReader());
	obj=createRenderableFromMesh(loader.loadModel(Gdx.files.internal("Mesh/teapot.g3db")).meshParts.get(0).mesh,
			new Material(ColorAttribute.createDiffuse(Color.BLUE)), pbrShader, null);
	obj.worldTransform.scl(5);
}
 
开发者ID:PWorlds,项目名称:LibGDX-PBR,代码行数:47,代码来源:PBRTestAPP.java

示例9: create

import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader; //导入依赖的package包/类
@Override
    public void create() {

        logger.info("Setting up camera");

        camera = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//        camera.position.set(40f, 30f, 40f);
        camera.position.set(45f, 29f, 73f);
//        camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//        camera.position.set(4f, 3f, 4f);
        camera.lookAt(0, 2f, 0);
        camera.near = 1f;
        camera.far = 500f;
        camera.update();

        cameraInputController = new CameraInputController(camera);
        Gdx.input.setInputProcessor(cameraInputController);
//        Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));


        logger.info("Loading models");
        models = new HashMap<>();
        ModelBuilder builder = new ModelBuilder();
        models.put("box", builder.createBox(5f, 5f, 5f,
                new Material(ColorAttribute.createDiffuse(new Color(0.8f, 0f, 0f, 0f))),
                VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal));

        G3dModelLoader loader = new G3dModelLoader(new JsonReader());
        models.put("hub", loader.loadModel(Gdx.files.internal("data/hubreal.g3dj")));
        models.put("rim", loader.loadModel(Gdx.files.internal("data/rimreal.g3dj")));
        models.put("spoke", loader.loadModel(Gdx.files.internal("data/spoke.g3dj")));


        logger.info("Let there be light");
        batch = new ModelBatch();

        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.6f, 0.6f, 0.6f, 1f));

        environment.add(new DirectionalLight().set(0.3f, 0.3f, 0.3f, -5f, -3f, -1f));
        environment.add(new DirectionalLight().set(0.2f, 0.2f, 0.2f, 5f, 8f, 0f));
        environment.add(new DirectionalLight().set(0.7f, 0.7f, 0.7f, -3f, -2f, -5f));


        logger.info("Initializing Bullet");
        Bullet.init();

        logger.info("Creating simulation");
        // create world & stuff?
        spokeAngles = new SpokeAngles();
//        spokeAngles.create2l2t();
//        spokeAngles.createCrowFoot();
//        spokeAngles.createNx(3);
//        spokeAngles.createPer3mutation(new int[]{3, 14, 5, 0, 7, 2, 9, 4, 11, 6, 13, 8, 15, 10, 1, 12}); // 3x as well!

//        spokeAngles.createPermutation(new int[]{14, 2, 3, 15, 7, 5, 6, 10, 4, 9, 8, 11, 12, 0, 1, 13});
//        spokeAngles.createPermutation(new int[]{2, 0, 1, 5, 3, 8, 10, 4, 12, 6, 11, 7, 9, 15, 13, 14});
//        spokeAngles.createPermutation(new int[]{0, 15, 3, 2, 4, 9, 6, 7, 8, 5, 10, 11, 12, 13, 14, 1});
        spokeAngles.createRandom();
//        spokeAngles.createBack();
//        spokeAngles.createSingel();
        simulation = new Simulation("sim1", models, spokeAngles, true);

        rayResultCallback = new ClosestRayResultCallback(new Vector3(), new Vector3());
        rayResultCallback.setCollisionFilterGroup(SimulationConstants.RAY_GROUP);

        logger.info("Setup complete");
    }
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:69,代码来源:WheelRenderer.java


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