當前位置: 首頁>>代碼示例>>Java>>正文


Java Model類代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.g3d.Model的典型用法代碼示例。如果您正苦於以下問題:Java Model類的具體用法?Java Model怎麽用?Java Model使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Model類屬於com.badlogic.gdx.graphics.g3d包,在下文中一共展示了Model類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addBackground

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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);
    }
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:19,代碼來源:ScreenRaider.java

示例2: AssetsCrafting

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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);
    }
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:21,代碼來源:AssetsCrafting.java

示例3: AssetsButton

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:23,代碼來源:AssetsButton.java

示例4: loadResurse

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:17,代碼來源:AssetsChoiceFaction.java

示例5: GameObject

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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);
      }
  }
 
開發者ID:raphaelbruno,項目名稱:ZombieInvadersVR,代碼行數:20,代碼來源:GameObject.java

示例6: create

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
@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();
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:20,代碼來源:MainDef.java

示例7: create

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
/** Инициализация и загрузка ресурсов */
@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);
}
 
開發者ID:SinuXVR,項目名稱:GdxVR-Sample-1,代碼行數:23,代碼來源:GdxVR.java

示例8: getConfigurableAttributes

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
@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;
}
 
開發者ID:ncguy2,項目名稱:Argent,代碼行數:27,代碼來源:WorldObject.java

示例9: initWorld

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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));
}
 
開發者ID:ToxSickCoder,項目名稱:Skyland,代碼行數:17,代碼來源:TreeGenerator.java

示例10: createBoxes

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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;
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:25,代碼來源:SpokeCreator.java

示例11: EntityConstructor

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
/**
     * 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);
    }
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:26,代碼來源:EntityConstructor.java

示例12: createConstructionInfo

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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);
    }
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:20,代碼來源:EntityConstructor.java

示例13: create

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
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);
	}
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:19,代碼來源:BulletConstructor.java

示例14: create

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
@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();
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:21,代碼來源:ConvexHullDistanceTest.java

示例15: create

import com.badlogic.gdx.graphics.g3d.Model; //導入依賴的package包/類
@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);
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:27,代碼來源:GimpactTest.java


注:本文中的com.badlogic.gdx.graphics.g3d.Model類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。