@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(); }
public GameScene(ModelLoader.ModelParameters modelParameters, TextureLoader.TextureParameter textureParameter, ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter, String pfxPath, String modelPath, String modelExt, ObjectMap<String, GameObjectBlueprint> sharedBlueprints) { this.sharedBlueprints = sharedBlueprints; this.assets = new BlenderAssetManager(modelParameters, textureParameter, pfxParameter, pfxPath, modelPath, modelExt); }
public GameSceneManager(ModelLoader.ModelParameters modelParameters, TextureLoader.TextureParameter textureParameter, ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter, String pfxPath, String modelPath, String modelExt) { this.modelPath = modelPath; this.modelExt = modelExt; this.pfxPath = pfxPath; this.modelParameters = modelParameters; this.textureParameter = textureParameter; this.pfxParameter = pfxParameter; }
public BlenderAssetManager( ModelLoader.ModelParameters modelParameters, TextureLoader.TextureParameter textureParameter, ParticleEffectLoader.ParticleEffectLoadParameter pfxParameter, String pfxPath, String modelPath, String modelExt) { this.modelExt = modelExt; this.modelPath = modelPath; this.pfxPath = pfxPath; this.modelParameters = modelParameters; this.textureParameter = textureParameter; this.pfxParameter = pfxParameter; }
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; }
@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); }
@Override public ModelData loadModelData(FileHandle fileHandle, ModelLoader.ModelParameters parameters) { return parseModel(fileHandle); }
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(); } }
@Override public ModelData loadModelData (FileHandle fileHandle, ModelLoader.ModelParameters parameters) { return parseModel(fileHandle); }