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);
}
java类com.badlogic.gdx.graphics.g3d.Model的实例源码
ScreenRaider.java 文件源码
项目:enklave
阅读 29
收藏 0
点赞 0
评论 0
AssetsCrafting.java 文件源码
项目:enklave
阅读 16
收藏 0
点赞 0
评论 0
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);
}
AssetsButton.java 文件源码
项目:enklave
阅读 24
收藏 0
点赞 0
评论 0
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);
}
AssetsChoiceFaction.java 文件源码
项目:enklave
阅读 17
收藏 0
点赞 0
评论 0
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);
}
GameObject.java 文件源码
项目:ZombieInvadersVR
阅读 22
收藏 0
点赞 0
评论 0
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);
}
}
MainDef.java 文件源码
项目:nhglib
阅读 28
收藏 0
点赞 0
评论 0
@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.java 文件源码
项目:GdxVR-Sample-1
阅读 24
收藏 0
点赞 0
评论 0
/** Инициализация и загрузка ресурсов */
@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);
}
WorldObject.java 文件源码
项目:Argent
阅读 42
收藏 0
点赞 0
评论 0
@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;
}
TreeGenerator.java 文件源码
项目:Skyland
阅读 34
收藏 0
点赞 0
评论 0
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));
}
SpokeCreator.java 文件源码
项目:eamaster
阅读 18
收藏 0
点赞 0
评论 0
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;
}
EntityConstructor.java 文件源码
项目:eamaster
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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);
}
EntityConstructor.java 文件源码
项目:eamaster
阅读 19
收藏 0
点赞 0
评论 0
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);
}
BulletConstructor.java 文件源码
项目:eamaster
阅读 27
收藏 0
点赞 0
评论 0
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);
}
}
ConvexHullDistanceTest.java 文件源码
项目:eamaster
阅读 23
收藏 0
点赞 0
评论 0
@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();
}
GimpactTest.java 文件源码
项目:eamaster
阅读 23
收藏 0
点赞 0
评论 0
@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);
}
ControllerPlanet.java 文件源码
项目:Alien-Ark
阅读 21
收藏 0
点赞 0
评论 0
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();
}
UsefulMeshs.java 文件源码
项目:Mundus
阅读 25
收藏 0
点赞 0
评论 0
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();
}
ScaleTool.java 文件源码
项目:Mundus
阅读 21
收藏 0
点赞 0
评论 0
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 };
}
GameModel.java 文件源码
项目:GdxDemo3D
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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);
}
Ragdoll.java 文件源码
项目:GdxDemo3D
阅读 20
收藏 0
点赞 0
评论 0
/**
* 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);
}
ModelFactory.java 文件源码
项目:GdxDemo3D
阅读 31
收藏 0
点赞 0
评论 0
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());
}
VRContext.java 文件源码
项目:Tower-Defense-Galaxy
阅读 30
收藏 0
点赞 0
评论 0
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);
}
LevelSelectScreen.java 文件源码
项目:Tower-Defense-Galaxy
阅读 26
收藏 0
点赞 0
评论 0
@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);
}
LevelSelectScreen.java 文件源码
项目:Tower-Defense-Galaxy
阅读 21
收藏 0
点赞 0
评论 0
@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);
}
EnemySpawner.java 文件源码
项目:Tower-Defense-Galaxy
阅读 29
收藏 0
点赞 0
评论 0
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);
}
ScreenProfile.java 文件源码
项目:enklave
阅读 27
收藏 0
点赞 0
评论 0
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();
}
AssetsEnklave3D.java 文件源码
项目:enklave
阅读 22
收藏 0
点赞 0
评论 0
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);
}
RaiderMap.java 文件源码
项目:enklave
阅读 23
收藏 0
点赞 0
评论 0
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);
}
Enemy.java 文件源码
项目:ZombieInvadersVR
阅读 27
收藏 0
点赞 0
评论 0
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;
}
Ground.java 文件源码
项目:ZombieInvadersVR
阅读 30
收藏 0
点赞 0
评论 0
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;
}