Java 类com.badlogic.gdx.graphics.g3d.Model 实例源码

项目:enklave    文件:ScreenRaider.java   
private void addBackground(){
        decalBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting)));
        decalBackground.setDimensions(100,200);
        decalBackground.setPosition(0,0,0);
        environment = new Environment();
//        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
        environment.set(new ColorAttribute(ColorAttribute.Diffuse));
        environment.set(new ColorAttribute(ColorAttribute.Specular));
        environment.set(new ColorAttribute(ColorAttribute.Reflection));
        environment.add(new DirectionalLight().set(0.51f, 0.5f, 0.5f, 0f, -2f, -30f));
        Model model = managerAssets.getAssetsRaider().getModel(NameFiles.raiderFull);
        model.nodes.get(2).translation.set(-12,28.6f,-5.5f);
//        model.nodes.get(0).translation.set(0,28f,29.2f);
//        model.nodes.get(2).translation.set(0,13,-1);
        instance = new ModelInstance(model);
        instance.transform.trn(0,-20,25).rotate(0,1,0,-25);
        instance.transform.scale(1.5f,1.5f,1.5f);
    }
项目:enklave    文件:AssetsCrafting.java   
public AssetsCrafting() {
        manager = new AssetManager();
//        manager.load(NameFiles.craftingbuttonNext,Texture.class);
//        manager.load(NameFiles.craftingbuttonnextchek,Texture.class);
//        manager.load(NameFiles.craftingbuttonback,Texture.class);
//        manager.load(NameFiles.craftingbuttonbackcheck,Texture.class);
//        manager.load(NameFiles.craftingimgnext,Texture.class);
//        manager.load(NameFiles.craftingimgnextcheck,Texture.class);
//        manager.load(NameFiles.craftingimgback,Texture.class);
//        manager.load(NameFiles.craftingimgbackcheck,Texture.class);
        manager.load(NameFiles.suport3D,Model.class);
        manager.load(NameFiles.scrapModel3D, Model.class);
        manager.load(NameFiles.cellModel3D,Model.class);
        manager.load(NameFiles.brickModel3D,Model.class);
        manager.load(NameFiles.backgroundCrafting,Texture.class);
        manager.load(NameFiles.backgroundModel3d,Texture.class);
        manager.load(NameFiles.buttonCraft,Texture.class);
        manager.load(NameFiles.backgroundbuttoncreft,Texture.class);
        manager.load(NameFiles.arrowcrafting,Texture.class);
    }
项目:enklave    文件:AssetsButton.java   
public AssetsButton() {
    manager = new AssetManager();
    manager.load(NameFiles.buttonLeft, Texture.class);
    manager.load(NameFiles.buttonRight,Texture.class);
    manager.load(NameFiles.buttontwoLeft,Texture.class);
    manager.load(NameFiles.button_describe,Texture.class);
    manager.load(NameFiles.logoEnklave,Texture.class);
    manager.load(NameFiles.buttonBack1,Texture.class);
    manager.load(NameFiles.buttonShowEnklave,Texture.class);
    manager.load(NameFiles.imageInformationEnklave,Texture.class);
    manager.load(NameFiles.buttonTabCraft,Texture.class);
    manager.load(NameFiles.imageFactionArhitects,Texture.class);
    manager.load(NameFiles.backDeployBricks,Texture.class);
    manager.load(NameFiles.buttonMinusCraft,Texture.class);
    manager.load(NameFiles.buttonPlusCraft,Texture.class);
    manager.load(NameFiles.cursorTextField,Texture.class);
    manager.load(NameFiles.logoEdenites3D, Model.class);
    manager.load(NameFiles.logoArhitects3D,Model.class);
    manager.load(NameFiles.logoPrometheans3D,Model.class);
    manager.load(NameFiles.disaibleButton,Texture.class);
    manager.load(NameFiles.buttonStartCombat,Texture.class);
}
项目:enklave    文件:AssetsChoiceFaction.java   
public void loadResurse(){
    manager = new AssetManager();

    manager.load(NameFiles.labelEdenites,Texture.class);
    manager.load(NameFiles.labelPrometheans,Texture.class);
    manager.load(NameFiles.labelArhitects,Texture.class);
    manager.load(NameFiles.txtDescribeEdenites,Texture.class);
    manager.load(NameFiles.txtDescribePrometheans,Texture.class);
    manager.load(NameFiles.txtDescribeArhitects,Texture.class);
    manager.load(NameFiles.frameSelected,Texture.class);
    manager.load(NameFiles.labelTitle,Texture.class);
    manager.load(NameFiles.logoArhitects3D, Model.class);
    manager.load(NameFiles.logoEdenites3D,Model.class);
    manager.load(NameFiles.logoEdenites3D,Model.class);
    manager.load(NameFiles.logoPrometheans3D,Model.class);
}
项目:ZombieInvadersVR    文件:GameObject.java   
public GameObject(ScreenBase context, Model model, BoundingBox bounds) {
super(model);
this.context = context;
this.customBounds = bounds;

      this.bounds = this.customBounds != null ? this.customBounds : new BoundingBox();
      this.center = new Vector3();
      this.enabled = true;
      updateBox();

      this.animations = new AnimationController(this);
      this.blending = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

      for(Material item : materials){
        item.set(new DepthTestAttribute(GL20.GL_LEQUAL, 0.01f, 25f, true));
    item.set(FloatAttribute.createAlphaTest(0.01f));
        item.set(blending);
      }
  }
项目:nhglib    文件:MainDef.java   
@Override
public void create() {
    super.create();

    geometryPass = new ShaderProgram(
            Gdx.files.internal("shaders/g_buffer.vert"),
            Gdx.files.internal("shaders/g_buffer.frag"));

    lightingPass = new ShaderProgram(
            Gdx.files.internal("shaders/deferred_shader.vert"),
            Gdx.files.internal("shaders/deferred_shader.frag"));

    ModelBuilder mb = new ModelBuilder();
    Model cube = mb.createBox(1, 1, 1, new Material(),
            VertexAttributes.Usage.Position |
                    VertexAttributes.Usage.Normal |
                    VertexAttributes.Usage.TextureCoordinates);
    cubeMesh = cube.meshes.first();
}
项目:GdxVR-Sample-1    文件:GdxVR.java   
/** Инициализация и загрузка ресурсов */
@Override
public void create () {
    // Размеры экрана
    scrHalfWidth = Gdx.graphics.getWidth() / 2;
    scrHeight = Gdx.graphics.getHeight();

    // Загрузка модели из файла
    modelBatch = new ModelBatch();
    assets = new  AssetManager();
    assets.load("room.g3db", Model.class);
    assets.finishLoading();
    Model roomModel = assets.get("room.g3db");
    roomInstance = new ModelInstance(roomModel);

    // Создание камеры (fov, parallax, near, far) и установка позиции
    vrCamera = new VRCamera(90, 0.4f, 0.1f, 30f);
    vrCamera.setPosition(-1.7f, 3f, 3f);

    // Разрешаем коррекцию дрифта при помощи компаса
    vrSensorManager.useDriftCorrection(true);
}
项目:Argent    文件:WorldObject.java   
@Override
public List<ConfigurableAttribute<?>> getConfigurableAttributes() {
    List<ConfigurableAttribute<?>> attrs = new ArrayList<>();

    attr(attrs, new Meta.Object("Translation X", "Transform"),   () -> ((Float)transform().getValues()[Reference.Matrix4Alias.TranslationX]).intValue(),   (val) -> { transform().getValues()[Reference.Matrix4Alias.TranslationX] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Translation Y", "Transform"),   () -> ((Float)transform().getValues()[Reference.Matrix4Alias.TranslationY]).intValue(),   (val) -> { transform().getValues()[Reference.Matrix4Alias.TranslationY] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Translation Z", "Transform"),   () -> ((Float)transform().getValues()[Reference.Matrix4Alias.TranslationZ]).intValue(),   (val) -> { transform().getValues()[Reference.Matrix4Alias.TranslationZ] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);

    attr(attrs, new Meta.Object("Rotation Roll", "Transform"),   () -> ((Float)rotRoll).intValue(),                                                      (val) -> { rotRoll =Float.parseFloat(val.toString()); updateTransform(); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Rotation Pitch", "Transform"),  () -> ((Float)rotPitch).intValue(),                                                     (val) -> { rotPitch=Float.parseFloat(val.toString()); updateTransform(); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Rotation Yaw", "Transform"),    () -> ((Float)rotYaw).intValue(),                                                       (val) -> { rotYaw  =Float.parseFloat(val.toString()); updateTransform(); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);

    attr(attrs, new Meta.Object("Scale X", "Transform"),         () -> ((Float)transform().getValues()[Reference.Matrix4Alias.ScaleX]).intValue(),         (val) -> { transform().getValues()[Reference.Matrix4Alias.ScaleX] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Scale Y", "Transform"),         () -> ((Float)transform().getValues()[Reference.Matrix4Alias.ScaleY]).intValue(),         (val) -> { transform().getValues()[Reference.Matrix4Alias.ScaleY] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Scale Z", "Transform"),         () -> ((Float)transform().getValues()[Reference.Matrix4Alias.ScaleZ]).intValue(),         (val) -> { transform().getValues()[Reference.Matrix4Alias.ScaleZ] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);

    ConfigurableAttribute modelAttr = attr(attrs, new Meta.Object("Model", "Rendering"), this::getModelRef, this::setModel, ConfigControl.SELECTIONLIST);
    String[] modelRefs = Argent.content.getAllRefs(Model.class);
    SearchableList.Item.Data[] modelItems = new SearchableList.Item.Data[modelRefs.length];
    int index = 0;
    for (String ref : modelRefs)
        modelItems[index++] = new SearchableList.Item.Data<>(new TextureRegionDrawable(new TextureRegion(net.ncguy.argent.utils.SpriteCache.pixel())), ref, ref);
    modelAttr.addParam("items", SearchableList.Item.Data[].class, modelItems);

    return attrs;
}
项目:Skyland    文件:TreeGenerator.java   
public static void initWorld(BulletWorld world) {
    //TreeShape
    Model model = Assets.get(Models.MODEL_TREE_PROTOTYPE, Model.class);
    model.nodes.first().translation.set(0, -1.15f, 0);
    btCompoundShape treeShape = new btCompoundShape();
    treeShape.addChildShape(new Matrix4(new Vector3(0, 0, 0), new Quaternion(), new Vector3(1, 1, 1)), new btBoxShape(new Vector3(.2f, .9f, .2f)));
    treeShape.addChildShape(new Matrix4(new Vector3(0, 1, 0), new Quaternion(), new Vector3(1, 1, 1)), new btSphereShape(1));
    //LogShape
    model = Assets.get(Models.MODEL_LOG_PROTOTYPE, Model.class);
    model.nodes.first().translation.set(0, -1.15f, 0);

    world.addConstructor("log", new BulletConstructor(Assets.get(Models.MODEL_LOG_PROTOTYPE, Model.class), 75, new btBoxShape(new Vector3(.2f, .9f, .2f))));
    world.addConstructor("stump", new BulletConstructor(Assets.get(Models.MODEL_STUMP_PROTOTYPE, Model.class), 0, new btCylinderShape(new Vector3(.2f, .22f, .2f))));
    world.addConstructor("staticTree", new BulletConstructor(Assets.get(Models.MODEL_TREE_PROTOTYPE, Model.class), 0, treeShape));
    world.addConstructor("dynamicTree", new BulletConstructor(Assets.get(Models.MODEL_TREE_PROTOTYPE, Model.class), 100, treeShape));
}
项目:eamaster    文件:SpokeCreator.java   
private List<Box> createBoxes(Model boxModel) {
    float boxSize = SimulationConstants.BOX_SIZE;
    float boxMass = SimulationConstants.BOX_MASS;

    btCollisionShape boxShape = new btBoxShape(new Vector3(boxSize, boxSize, boxSize));
    Vector3 boxInertia = new Vector3(0, 0, 0);
    boxShape.calculateLocalInertia(boxMass, boxInertia);


    btRigidBody.btRigidBodyConstructionInfo boxInfo = new btRigidBody.btRigidBodyConstructionInfo(boxMass, null, boxShape, boxInertia);
    boxInfo.setLinearDamping(0.1f);
    boxInfo.setAngularDamping(0.1f);

    List<Box> boxes = new ArrayList<>();

    for (int i = 0; i < SimulationConstants.NUM_SPOKES; i++) {
        boxes.add(new Box(name + "box" + i, boxModel, boxInfo));
    }

    boxes.get(0).disposables.add(boxShape); // One of them needs to dispose the shape when done
    boxInfo.dispose();

    return boxes;
}
项目:eamaster    文件:EntityConstructor.java   
/**
     * Generates a convex hull based on the model as the shape
     */
    public EntityConstructor(String name, Model model, float mass, boolean disableDeactivation) {
        Mesh modelMesh = model.meshes.get(0);
        btCollisionShape shape = new btConvexHullShape(modelMesh.getVerticesBuffer(), modelMesh.getNumVertices(), modelMesh.getVertexSize());


//        btTriangleIndexVertexArray i = new btTriangleIndexVertexArray(model.meshParts);
//        btGImpactMeshShape shapeImp = new btGImpactMeshShape(i);
//
//        shapeImp.setLocalScaling(new Vector3(1f, 1f, 1f));
//        shapeImp.setMargin(0.05f);
//        shapeImp.updateBound();
//        optimizing the shape
//        btShapeHull hull = new btShapeHull((btConvexShape) shape);
//        hull.buildHull(shape.getMargin());

//        shape = new btConvexHullShape(hull);

//        btCompoundShape shape = new btCompoundShape();
//        shape.addChildShape(new Matrix4(), shapeImp);

        createConstructionInfo(name, model, mass, shape, disableDeactivation);
    }
项目:eamaster    文件:EntityConstructor.java   
private void createConstructionInfo(String name, Model model,float mass, btCollisionShape shape, boolean disableDeactivation) {
        this.name = name;
        this.model = model;
        this.disableDeactivation = disableDeactivation;

        logger.debug("Creating constructor '{}'", name);

        Vector3 localInertia = new Vector3(0, 0, 0);
        if (mass > 0f) {
            shape.calculateLocalInertia(mass, localInertia);
            logger.debug("Inertia for '{}' calculated to '{}'", name, localInertia);
        }

        if (name.equals("rim")) {
//            localInertia.set(25f, 25f, 50f);
        }

        info = new btRigidBody.btRigidBodyConstructionInfo(mass, null, shape, localInertia);
    }
项目:eamaster    文件:BulletConstructor.java   
private void create (final Model model, final float mass, final btCollisionShape shape) {
    this.model = model;
    this.shape = shape;

    if (shape != null && mass >= 0) {
        // Calculate the local inertia, bodies with no mass are static
        Vector3 localInertia;
        if (mass == 0)
            localInertia = Vector3.Zero;
        else {
            shape.calculateLocalInertia(mass, tmpV);
            localInertia = tmpV;
        }

        // For now just pass null as the motionstate, we'll add that to the body in the entity itself
        bodyInfo = new btRigidBodyConstructionInfo(mass, null, shape, localInertia);
    }
}
项目:eamaster    文件:ConvexHullDistanceTest.java   
@Override
public void create () {
    super.create();

    final Model carModel = objLoader.loadModel(Gdx.files.internal("data/car.obj"));
    disposables.add(carModel);
    carModel.materials.get(0).clear();
    carModel.materials.get(0).set(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.WHITE));
    world.addConstructor("car", new BulletConstructor(carModel, 5f, createConvexHullShape(carModel, true)));

    // Create the entities
    world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(),
        0.25f + 0.5f * (float)Math.random(), 1f);

    for (float y = 10f; y < 50f; y += 5f)
        world.add("car", -2f + (float)Math.random() * 4f, y, -2f + (float)Math.random() * 4f).setColor(
            0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f);
    distance = new ConvexHullDistance();
    shapeRenderer = new ShapeRenderer();
}
项目:eamaster    文件:GimpactTest.java   
@Override
public void create () {
    super.create();

    final Model chassisModel = objLoader.loadModel(Gdx.files.internal("data/car.obj"));
    disposables.add(chassisModel);
    chassisModel.materials.get(0).clear();
    chassisModel.materials.get(0).set(ColorAttribute.createDiffuse(Color.RED), ColorAttribute.createSpecular(Color.WHITE));

    chassisVertexArray = new btTriangleIndexVertexArray(chassisModel.meshParts);
    btGImpactMeshShape chassisShape = new btGImpactMeshShape(chassisVertexArray);
    chassisShape.setLocalScaling(new Vector3(1f, 1f, 1f));
    chassisShape.setMargin(0f);
    chassisShape.updateBound();

    world.addConstructor("chassis", new BulletConstructor(chassisModel, 1f, chassisShape));

    (ground = world.add("ground", 0f, 0f, 0f)).setColor(0.25f + 0.5f * (float)Math.random(),
        0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f);

    world.add("chassis", 3f, 10f, 3f);
    world.add("chassis", 4f, 5f, 3f);
    world.add("chassis", 4f, 1f, 5f);

       btGImpactCollisionAlgorithm.registerAlgorithm(world.dispatcher);
}
项目:Alien-Ark    文件:ControllerPlanet.java   
public static Model createInfiniteWaterPart(TypeInterpreter interpreter, int landscapeIndex, PlanetConfig planetConfig) {
    ModelBuilder modelBuilder = new ModelBuilder();
    MeshBuilder builder = new MeshBuilder();
    float waterHeight = interpreter.it.get(landscapeIndex).endValue;
    builder.begin(PlanetPart.VERTEX_ATTRIBUTES, GL20.GL_TRIANGLES);
    infiniteWaterHeight = waterHeight * planetConfig.landscapeHeight - 1;
    Vector3 corner01 = new Vector3(-INFINITE_WATER_SIZE, -INFINITE_WATER_SIZE, infiniteWaterHeight);
    Vector3 corner02 = new Vector3(INFINITE_WATER_SIZE, -INFINITE_WATER_SIZE, infiniteWaterHeight);
    Vector3 corner03 = new Vector3(INFINITE_WATER_SIZE, INFINITE_WATER_SIZE, infiniteWaterHeight);
    Vector3 corner04 = new Vector3(-INFINITE_WATER_SIZE, INFINITE_WATER_SIZE, infiniteWaterHeight);
    builder.rect(corner01, corner02, corner03, corner04, new Vector3(0, 0, 1));
    Material waterMaterial = planetConfig.layerConfigs.get(landscapeIndex).material;
    Mesh mesh = builder.end();
    modelBuilder.begin();
    modelBuilder.part(PlanetPart.LANDSCAPE_PART_NAME + landscapeIndex, mesh, GL20.GL_TRIANGLES, waterMaterial);
    return modelBuilder.end();
}
项目:Mundus    文件:UsefulMeshs.java   
public static Model createAxes() {
    final float GRID_MIN = -10f;
    final float GRID_MAX = 10f;
    final float GRID_STEP = 1f;
    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();
    MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.LIGHT_GRAY);
    for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) {
        builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX);
        builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t);
    }
    builder = modelBuilder.part("axes", GL20.GL_LINES,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.RED);
    builder.line(0, 0, 0, 100, 0, 0);
    builder.setColor(Color.GREEN);
    builder.line(0, 0, 0, 0, 100, 0);
    builder.setColor(Color.BLUE);
    builder.line(0, 0, 0, 0, 0, 100);
    return modelBuilder.end();
}
项目:Mundus    文件:ScaleTool.java   
public ScaleTool(ProjectManager projectManager, GameObjectPicker goPicker, ToolHandlePicker handlePicker,
        ShapeRenderer shapeRenderer, ModelBatch batch, CommandHistory history) {
    super(projectManager, goPicker, handlePicker, batch, history);

    this.shapeRenderer = shapeRenderer;

    ModelBuilder modelBuilder = new ModelBuilder();
    Model xPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_X)),
            Vector3.Zero, new Vector3(15, 0, 0));
    Model yPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_Y)),
            Vector3.Zero, new Vector3(0, 15, 0));
    Model zPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_Z)),
            Vector3.Zero, new Vector3(0, 0, 15));
    Model xyzPlaneHandleModel = modelBuilder.createBox(3, 3, 3,
            new Material(ColorAttribute.createDiffuse(COLOR_XYZ)),
            VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);

    xHandle = new ScaleHandle(X_HANDLE_ID, xPlaneHandleModel);
    yHandle = new ScaleHandle(Y_HANDLE_ID, yPlaneHandleModel);
    zHandle = new ScaleHandle(Z_HANDLE_ID, zPlaneHandleModel);
    xyzHandle = new ScaleHandle(XYZ_HANDLE_ID, xyzPlaneHandleModel);

    handles = new ScaleHandle[] { xHandle, yHandle, zHandle, xyzHandle };
}
项目:GdxDemo3D    文件:GameModel.java   
/**
 * Holds a an instance of the model.
 *
 * @param name       Name of model
 * @param model    Model to instantiate
 * @param location World position at which to place the model instance
 * @param rotation The rotation of the model instance in degrees
 * @param scale    Scale of the model instance
 */
public GameModel(Model model,
                 String name,
                 Vector3 location,
                 Vector3 rotation,
                 Vector3 scale) {
    super(name);
    modelInstance = new ModelInstance(model);

    applyTransform(location, rotation, scale, modelInstance);

    try {
        modelInstance.calculateBoundingBox(boundingBox);
    } catch (Exception e) {
        Gdx.app.debug(TAG, "Error when calculating bounding box.", e);
    }
    boundingBox.getCenter(center);
    boundingBox.getDimensions(dimensions);
    boundingBoxRadius = dimensions.len() / 2f;
    modelTransform = modelInstance.transform;
    halfExtents.set(dimensions).scl(0.5f);
}
项目:GdxDemo3D    文件:Ragdoll.java   
/**
 * Constructs a ragdoll out of rigid bodies using physics constraints.
 *
 * @param model            Model to instantiate
 * @param name               Name of model
 * @param location         World position at which to place the model instance
 * @param rotation         The rotation of the model instance in degrees
 * @param scale            Scale of the model instance
 * @param shape            Collision shape with which to construct a rigid body
 * @param mass             Mass of the body
 * @param belongsToFlag    Flag for which collision layers this body belongs to
 * @param collidesWithFlag Flag for which collision layers this body collides with
 * @param callback         If this body should trigger collision contact callbacks.
 * @param noDeactivate     If this body should never 'sleep'
 * @param ragdollEmpties      Blender empties with body part definitions
 * @param armatureNodeId   The id of the root node in the model animation armature
 * @param steerSettings    Steerable settings
 */
public Ragdoll(Model model,
               String name,
               Vector3 location,
               Vector3 rotation,
               Vector3 scale,
               btCollisionShape shape,
               float mass,
               short belongsToFlag,
               short collidesWithFlag,
               boolean callback,
               boolean noDeactivate,
               Array<BlenderEmpty> ragdollEmpties,
               String armatureNodeId,
               SteerSettings steerSettings) {

    super(model, name, location, rotation, scale, shape, mass,
            belongsToFlag, collidesWithFlag, callback, noDeactivate, steerSettings);

    createRagdoll(ragdollEmpties, armatureNodeId);
}
项目:GdxDemo3D    文件:ModelFactory.java   
public static Model buildPlaneModel(final float width,
                                    final float height, final Material material, final float u1,
                                    final float v1, final float u2, final float v2) {

    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();
    MeshPartBuilder bPartBuilder = modelBuilder.part("rect", GL20.GL_TRIANGLES,
            VertexAttributes.Usage.Position
                    | VertexAttributes.Usage.Normal
                    | VertexAttributes.Usage.TextureCoordinates, material);
    bPartBuilder.setUVRange(u1, v1, u2, v2);
    bPartBuilder.rect(-(width * 0.5f), -(height * 0.5f), 0, (width * 0.5f),
            -(height * 0.5f), 0, (width * 0.5f), (height * 0.5f), 0,
            -(width * 0.5f), (height * 0.5f), 0, 0, 0, -1);

    return (modelBuilder.end());
}
项目:Tower-Defense-Galaxy    文件:VRContext.java   
VRDevice(VRDevicePose pose, VRDeviceType type, VRControllerRole role) {
    this.pose = pose;
    this.type = type;
    this.role = role;
    Model model = loadRenderModel(getStringProperty(VRDeviceProperty.RenderModelName_String));          
    this.modelInstance = model != null ? new ModelInstance(model) : null;
    if (model != null) this.modelInstance.transform.set(pose.transform);
}
项目:Tower-Defense-Galaxy    文件:LevelSelectScreen.java   
@Override
public void show() {
    super.show();
    assets = new AssetManager();
    assets.load("theme/basic/campaign/scene.g3db", Model.class);
    modelBatch = new ModelBatch();
    environment = new Environment();

    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
    //environment.add(new DirectionalLight().set(1f, 1f, 1f, -1f, -1f, -1f));
    addDisposables(modelBatch, assets);
}
项目:Tower-Defense-Galaxy    文件:LevelSelectScreen.java   
@Override
public void render(float delta) {
    if(isLoading) {
        if (!assets.update())
            return;
        else {
            isLoading = false;
            scene = new ModelInstance(assets.get("theme/basic/campaign/scene.g3db", Model.class));
        }
    }
    super.render(delta);
}
项目:Tower-Defense-Galaxy    文件:EnemySpawner.java   
public EnemySpawner(Vector3 pos, Map<String, Class<?>> enemyClasses, List<Spawn> spawns, Map<String, Model> models, List<Enemy> enemies, List<Vector3> path, btCollisionWorld world, IntMap<Entity> entities, Map<String, Sound> sounds) {
    this.enemies = enemies;
    this.pos = pos;
    this.enemyClasses = enemyClasses;
    this.models = models;
    this.spawns = spawns;
    this.path = path;
    this.world = world;
    this.entity = entities;
    this.sounds = sounds;
    System.out.println(spawns);
}
项目:enklave    文件:ScreenProfile.java   
private void drawProfile() {
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
    environment.add(new DirectionalLight().set(1f, 1f, 1f, 1f, 1f, 1f));
    Model model = managerAssets.getAssetsProfile().getModel(NameFiles.profileObject);
    model.nodes.get(2).translation.set(0,-14.5f,9);
    instance = new ModelInstance(model);
    instance.transform.scale(0.2f,0.2f,0.2f);
    instance.transform.trn(0,-8f,27).rotate(0,1,0,55);
    decalBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting)));
    decalBackground.setDimensions(75,150);
    decalBackground.setPosition(0,0,0);
    queueDisplay = QueueDisplay.getInstance();
}
项目:enklave    文件:AssetsEnklave3D.java   
public AssetsEnklave3D() {
        manager = new AssetManager();
        manager.load(NameFiles.baseEnklave3D,Texture.class);
        manager.load(NameFiles.insideEnklave,Texture.class);
        manager.load(NameFiles.topEnklave3D,Texture.class);
        manager.load(NameFiles.circleEnklave,Texture.class);
//        manager.load(NameFiles.enklave3D, Model.class);
        manager.load(NameFiles.enklaveBlue3D,Model.class);
        manager.load(NameFiles.enklaveGreen3D,Model.class);
        manager.load(NameFiles.enklaveGrey3D,Model.class);
        manager.load(NameFiles.enklaveRed3D,Model.class);
    }
项目:enklave    文件:RaiderMap.java   
public RaiderMap() {
    manager = ManagerAssets.getInstance();
    Model model = manager.getAssetsRaider().getModel(NameFiles.raiderMap);
    model.nodes.get(2).translation.set(-11,26.5f,-3f);
    instance = new ModelInstance(model);
    instance.transform.scl(1.5f);
    instance.transform.trn(50,50,5);
    instance.transform.rotate(1,0,0,55);
    box = new BoundingBox();
    position = new Vector3();
    dimension = new Vector3();
    instance.calculateBoundingBox(box).mul(instance.transform);
    box.getCenter(position);
    box.getDimensions(dimension);
}
项目:ZombieInvadersVR    文件:Enemy.java   
public Enemy build(ScreenBase context, Enemy.Model3D model){
    Enemy enemy;

    enemy = new Enemy(context, AssetRepository.getInstance().load(model.getUrl(), Model.class));

    if(state != null) enemy.changeState(state);
    if(position != null) enemy.moveTo(position);
    if(rotation != null) enemy.rotateTo(rotation);
    if(alpha != null) enemy.alphaTo(alpha);
    if(randomSkin) enemy.setRandomSkin();

    return enemy;
}
项目:ZombieInvadersVR    文件:Ground.java   
public Ground build(ScreenBase context, String urlG3d){
    Ground level = new Ground(context, AssetRepository.getInstance().load(urlG3d, Model.class));

    if(position != null) level.moveTo(position);
    if(rotation != 0f) level.rotateTo(rotation);

    return level;
}
项目:ZombieInvadersVR    文件:MenuScreen.java   
@Override
public void setupScreen() {
    level = new Ground.Builder().build(this, "models/level.g3db");
    instances.add(level);

    uiStartGame = new Word.Builder().build(this, game.getString(R.string.ui_start));
    uiStartGame.moveTo(0f, 1.5f, -5f);
    instances.add(uiStartGame);

    uiHighScore = new Word.Builder().build(this, game.getString(R.string.ui_score), HudUtils.formattedScore(game.highScore));
    uiHighScore.rotateTo(90);
    uiHighScore.moveTo(-5f, 3.5f, 0f);
    instances.add(uiHighScore);

    uiExit = new Word.Builder().build(this, game.getString(R.string.ui_exit));
    uiExit.moveTo(0f, 2.5f, 5f);
    uiExit.rotateTo(180);
    instances.add(uiExit);

    uiDoor = new GameObject(this, AssetRepository.getInstance().load("models/door.g3db", Model.class));
    uiDoor.moveTo(0,0,5f);
    uiDoor.rotateTo(180f);
    instances.add(uiDoor);

    if(!game.soundBg.isPlaying())
        game.playBg();
}
项目:ZombieInvadersVR    文件:GameOverScreen.java   
@Override
public void setupScreen() {
    level = new Ground.Builder().build(this, "models/level.g3db");
    instances.add(level);

    deadEnemy = new Enemy.Builder().setPosition(0f, 0f, -2f).build(this);
    deadEnemy.enabled = false;
    deadEnemy.changeState(Enemy.State.DYING, 1);
    instances.add(deadEnemy);

    uiPlayAgain = new Word.Builder().build(this, game.getString(R.string.ui_play_again));
    uiPlayAgain.moveTo(0f, 1f, -5f);
    instances.add(uiPlayAgain);

    uiHighScore = new Word.Builder().build(this, game.getString(R.string.ui_score), HudUtils.formattedScore(game.highScore));
    uiHighScore.enabled = false;
    uiHighScore.moveTo(0f, 3f, -5f);
    instances.add(uiHighScore);

    uiExit = new Word.Builder().build(this, game.getString(R.string.ui_exit));
    uiExit.moveTo(0f, 2.5f, 5f);
    uiExit.rotateTo(180);
    instances.add(uiExit);

    uiDoor = new GameObject(this, AssetRepository.getInstance().load("models/door.g3db", Model.class));
    uiDoor.moveTo(0,0,5f);
    uiDoor.rotateTo(180f);
    instances.add(uiDoor);

    if(!game.soundBg.isPlaying())
        game.playBg();
}
项目:ZombieInvadersVR    文件:AssetRepository.java   
private synchronized <T> T loadAsset(String url, Class<T> clazz) {
    T asset = null;

    if(clazz == Model.class)
        asset = (T) modelLoader.loadModel(Gdx.files.getFileHandle(url, Files.FileType.Internal));
    if(clazz == Texture.class)
        asset = (T) new Texture(Gdx.files.getFileHandle(url, Files.FileType.Internal));

    return asset;
}
项目:Planetbase    文件:StrategyGame.java   
@Override
public void create() {
    INSTANCE=this;

    Debug.dbg("Path: "+System.getProperty("user.dir"));

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

    staticEntityBatch = new ModelBatch();

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    float cameraDist=0.8f;
    cam.position.set(cameraDist,cameraDist,cameraDist);
    cam.lookAt(0,0,0);
    cam.near = 0.1f;
    cam.far = 300f;
    cam.update();

    Assets.modelBuilder = new ModelBuilder();
    Model world = Assets.modelBuilder.createSphere(2f,2f,2f, 
            80, 80, /* 80x80 seems to be enough polys to look smooth */
            new Material(ColorAttribute.createDiffuse(Color.GREEN)),
            Usage.Position | Usage.Normal);
    models.add(world);

    planetSurface = new ModelInstance(world);

    camController = new CameraController(cam);
    Gdx.input.setInputProcessor(camController);

    space=new Space();
}
项目:thunderboard-android    文件:DemoMotionGdxAdapter.java   
public void initModel() {
    // initMatrix is our starting position, it has to compensate for any transforms
    // in the model file we load
    assets.load(getModelFilename(), Model.class);
    initOrientation();
    loading = true;
}
项目:nhglib    文件:SceneManager.java   
public SceneManager(Messaging messaging, Entities entities, Assets assets) {
    this.messaging = messaging;
    this.entities = entities;
    this.assets = assets;

    modelMapper = entities.getMapper(ModelComponent.class);
    rigidBodyMapper = entities.getMapper(RigidBodyComponent.class);
    vehicleMapper = entities.getMapper(VehicleComponent.class);
    vehicleWheelMapper = entities.getMapper(WheelComponent.class);
    particleEffectMapper = entities.getMapper(ParticleEffectComponent.class);

    SceneUtils.addComponentJsonMapping("message", MessageComponentJson.class);
    SceneUtils.addComponentJsonMapping("camera", CameraComponentJson.class);
    SceneUtils.addComponentJsonMapping("light", LightComponentJson.class);
    SceneUtils.addComponentJsonMapping("model", ModelComponentJson.class);
    SceneUtils.addComponentJsonMapping("rigidBody", RigidBodyComponentJson.class);
    SceneUtils.addComponentJsonMapping("vehicle", VehicleComponentJson.class);
    SceneUtils.addComponentJsonMapping("wheel", WheelComponentJson.class);
    SceneUtils.addComponentJsonMapping("particleEffect", ParticleEffectComponentJson.class);
    SceneUtils.addComponentJsonMapping("ui", UiComponentJson.class);

    SceneUtils.addAssetClassMapping("model", Model.class);
    SceneUtils.addAssetClassMapping("texture", Texture.class);
    SceneUtils.addAssetClassMapping("particleEffect", ParticleEffect.class);
    SceneUtils.addAssetClassMapping("hdr", HDRData2.class);
    SceneUtils.addAssetClassMapping("textureAtlas", TextureAtlas.class);
    SceneUtils.addAssetClassMapping("bitmapFont", BitmapFont.class);
}
项目:nhglib    文件:VehicleBuilder.java   
public VehicleBuilder setChassisAsset(Asset chassisAsset) {
    assets.loadAsset(chassisAsset, new Assets.AssetListener() {
        @Override
        public void onAssetLoaded(Asset asset) {
            setChassisModel((Model) assets.get(asset));
        }
    });

    return this;
}
项目:nhglib    文件:VehicleBuilder.java   
public VehicleBuilder setWheelAsset(Asset wheelAsset) {
    assets.loadAsset(wheelAsset, new Assets.AssetListener() {
        @Override
        public void onAssetLoaded(Asset asset) {
            setWheelModel((Model) assets.get(asset));
        }
    });

    return this;
}
项目:nhglib    文件:VehicleBuilder.java   
public VehicleBuilder setChassisModel(Model model) {
    this.chassisModel = model;

    ModelComponent modelComponent = entities.createComponent(vehicleEntity, ModelComponent.class);
    modelComponent.buildWithModel(model);

    return this;
}
项目:nhglib    文件:Assets.java   
public void init(Nhg nhg) {
    this.nhg = nhg;
    fsm = new DefaultStateMachine<>(this, AssetsStates.IDLE);

    assetManager = new AssetManager();
    syncAssetManager = new AssetManager();

    FileHandleResolver resolver = assetManager.getFileHandleResolver();
    FileHandleResolver syncResolver = syncAssetManager.getFileHandleResolver();

    assetManager.setLoader(Scene.class, new SceneLoader(nhg, resolver));
    assetManager.setLoader(InputProxy.class, new InputLoader(resolver));
    assetManager.setLoader(JsonValue.class, new JsonLoader(resolver));
    assetManager.setLoader(HDRData2.class, new HDRLoader(resolver));
    assetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(this,
            new UBJsonReader(), resolver));

    syncAssetManager.setLoader(Scene.class, new SceneLoader(nhg, syncResolver));
    syncAssetManager.setLoader(InputProxy.class, new InputLoader(syncResolver));
    syncAssetManager.setLoader(JsonValue.class, new JsonLoader(syncResolver));
    syncAssetManager.setLoader(HDRData2.class, new HDRLoader(syncResolver));
    syncAssetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(this,
            new UBJsonReader(), syncResolver));

    assetManager.setErrorListener(this);
    syncAssetManager.setErrorListener(this);

    assetQueue = new Array<>();
    assetCache = new ArrayMap<>();

    Texture.setAssetManager(assetManager);
}