本文整理匯總了Java中com.badlogic.gdx.graphics.g3d.ModelBatch類的典型用法代碼示例。如果您正苦於以下問題:Java ModelBatch類的具體用法?Java ModelBatch怎麽用?Java ModelBatch使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ModelBatch類屬於com.badlogic.gdx.graphics.g3d包,在下文中一共展示了ModelBatch類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GameScreen
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public GameScreen(){
spriteBatch = new SpriteBatch(); // buffer ok
texture = new Texture(Gdx.files.internal("bg/gameBG.jpg"));
viewMatrix = new Matrix4(); // matriz de visualização
tranMatrix = new Matrix4(); // matriz de escala
// camera
camera = new PerspectiveCamera(67.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.near = 0.1f;
camera.far = 1000f;
camera.position.set(0, 5, 10);
camera.lookAt(0, 5, 0);
camera.update();
// ambiente
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1,1,1,1));
// renderizador
modelBatch = new ModelBatch();
p1 = new Player(1);
p2 = new Player(2);
}
示例2: show
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
@Override
public void show() {
stage = new Stage(new StretchViewport(Width,Height));
stage.addActor(tabContinue);
PerspectiveCamera camera2 = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera2.position.set(0, -Width * 0.075f, Width * 0.135f);
camera2.lookAt(0, 0, 0);
camera2.far = Width*0.3f;
camera2.near = 1;
camera2.update();
controller = new CameraInputController(camera2);
CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera2);
batch = new DecalBatch(cameraGroupStrategy);
modelBatch = new ModelBatch();
InputMultiplexer in = new InputMultiplexer();
in.addProcessor(stage);
in.addProcessor(controller);
Gdx.input.setInputProcessor(in);
}
示例3: Renderer
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public Renderer(VuforiaRenderer arRenderer) {
lights = new Environment();
lights.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE));
camera = new PerspectiveCamera(60, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.near = 1.0F;
camera.far = 1000.0F;
//set camera into "Vuforia - style" direction
camera.position.set(new Vector3(0,0,0));
camera.lookAt(new Vector3(0,0,1));
this.vuforiaRenderer = arRenderer;
modelBatch = new ModelBatch();
}
示例4: create
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的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);
}
示例5: create
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
@Override
public void create() {
try {
logger.setLevel(Logger.DEBUG);
Gdx.app.setLogLevel(Application.LOG_DEBUG);
Texture.setAssetManager(assets);
spriteBatch = new SpriteBatch();
modelBatch = new ModelBatch();
game.create();
} catch (Exception e) {
logger.error(e.getMessage(), e);
Gdx.app.exit();
}
}
示例6: Renderer
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public Renderer () {
try {
lights = new Environment();
lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()));
spriteBatch = new SpriteBatch();
modelBatch = new ModelBatch();
backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true);
backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false);
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例7: create
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
@Override
public void create() {
Box2D.init();
_spriteBatch = new SpriteBatch();
_modelBatch = new ModelBatch();
_assetsHndlr = new AssetsHandler(_ASSETS_LIST_FILE_NAME);
_settings = new Settings(_SETTINS_NAME);
// Let shaders not use all available uniforms and attributes
ShaderProgram.pedantic = false;
// Disable for now bloom shader
_settings.SetIsBloomShaderEnabled(false);
setScreen(new LoadingScreen(this));
}
示例8: render
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public void render(ModelBatch batch, Environment environment) {
if (drawShapes) {
batch.render(hub.modelInstance, environment);
batch.render(rim.modelInstance, environment);
for (int i = 0; i < spokesToDraw; i++) {
spokes.get(i).updateSpokeRender();
batch.render(spokes.get(i).modelInstance, environment);
}
// spokes.forEach(s -> batch.render(s.modelInstance, environment));
// bulletWorld.updateAabbs();
}
if (debugDrawer.getDebugMode() > 0) {
Camera camera = batch.getCamera();
batch.flush();
debugDrawer.begin(camera);
bulletWorld.debugDrawWorld();
debugDrawer.end();
}
}
示例9: render
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public void render(ModelBatch batch, Environment environment) {
if (drawShapes) {
for (WorldEntity entity : entities) {
batch.render(entity.instance, environment);
}
batch.render(instances);
}
if (getDebugMode() > 0) {
Camera camera = batch.getCamera();
batch.flush();
debugDrawer.begin(camera);
bulletWorld.debugDrawWorld();
debugDrawer.end();
// batch.begin(camera);
}
}
示例10: PerspectiveRenderer
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
/**
* Renderer for all visible 3D components.
*
* @param camera
* @param boardController
* handles interactions between the behind the scenes logic and
* what is drawn
* @param piecePlacement
* array of 64 shorts defining the contents of all 64 board
* locations
*/
public PerspectiveRenderer(Camera camera, BoardController boardController, short[] piecePlacement) {
mCamera = camera;
mBoardController = boardController;
mShadowBatch = new ModelBatch(new DepthShaderProvider());
mCubeMapBatch = new ModelBatch(Gdx.files.internal("shaders/cubevertex.glsl"), Gdx.files.internal("shaders/cubefragment.glsl"));
mBackgroundBatch = new ModelBatch();
mEnvironment = new Environment();
mBackgroundEnvironment = new Environment();
mDrawables = new Array<ABaseObject>();
mGraveyard = new ChessPieceGraveyard();
mLightDirection = new Vector3(11.0f, -9.0f, 11.0f);
configureEnvironments();
createGameObjects(piecePlacement);
}
示例11: ToolManager
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public ToolManager(InputManager inputManager, ProjectManager projectManager, GameObjectPicker goPicker,
ToolHandlePicker toolHandlePicker, ModelBatch modelBatch, ShapeRenderer shapeRenderer,
CommandHistory history) {
this.inputManager = inputManager;
this.activeTool = null;
terrainBrushes = new Array<>();
terrainBrushes.add(new SmoothCircleBrush(projectManager, modelBatch, history));
terrainBrushes.add(new CircleBrush(projectManager, modelBatch, history));
terrainBrushes.add(new StarBrush(projectManager, modelBatch, history));
terrainBrushes.add(new ConfettiBrush(projectManager, modelBatch, history));
modelPlacementTool = new ModelPlacementTool(projectManager, modelBatch, history);
selectionTool = new SelectionTool(projectManager, goPicker, modelBatch, history);
translateTool = new TranslateTool(projectManager, goPicker, toolHandlePicker, modelBatch, history);
rotateTool = new RotateTool(projectManager, goPicker, toolHandlePicker, shapeRenderer, modelBatch, history);
scaleTool = new ScaleTool(projectManager, goPicker, toolHandlePicker, shapeRenderer, modelBatch, history);
}
示例12: ScaleTool
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
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 };
}
示例13: GameRenderer
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public GameRenderer(Viewport viewport, Camera camera, GameEngine engine) {
this.viewport = viewport;
this.camera = camera;
this.engine = engine;
shapeRenderer = new MyShapeRenderer();
shapeRenderer.setAutoShapeType(true);
spriteBatch = new SpriteBatch();
font = new BitmapFont();
font.setColor(Color.WHITE);
font.setUseIntegerPositions(false);
font.getData().setScale(0.01f);
shadowBatch = new ModelBatch(new DepthShaderProvider());
ShaderProgram.pedantic = false;
final String vertUber = Gdx.files.internal("shaders/uber.vert").readString();
final String fragUber = Gdx.files.internal("shaders/uber.frag").readString();
modelBatch = new ModelBatch(new DefaultShaderProvider(vertUber, fragUber) {
@Override
protected Shader createShader(final Renderable renderable) {
return new UberShader(renderable, config);
}
});
}
示例14: MiniMap
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
public MiniMap(Rocket rocket, ControllerPlanet planetController) {
this.rocket = rocket;
this.planetController = planetController;
miniMapModelBatch = new ModelBatch();
miniMapBatch = new SpriteBatch();
miniMapCamera = new OrthographicCamera(MINI_MAP_SIZE * MINI_ZOOM, MINI_MAP_SIZE * MINI_ZOOM);
miniMapCamera.near = 1f;
miniMapCamera.far = 300f;
rocketArrow = App.TEXTURES.findRegion("rocket_arrow");
shieldIcon = App.TEXTURES.findRegion("minimap_shield");
fuelIcon = App.TEXTURES.findRegion("minimap_fuel");
artifactIcon = App.TEXTURES.findRegion("minimap_artifact");
minimapBorder = App.TEXTURES.findRegion("minimapBorder");
planetPortal = App.TEXTURES.findRegion("planetPortal");
raceIcon = App.TEXTURES.findRegion("minimap_race");
}
示例15: create
import com.badlogic.gdx.graphics.g3d.ModelBatch; //導入依賴的package包/類
@Override
public void create () {
ObjLoader objLoader = new ObjLoader();
sphere = objLoader.loadObj(Gdx.files.internal("data/sphere.obj"));
sphere.materials.get(0).set(new ColorAttribute(ColorAttribute.Diffuse, Color.WHITE));
cam = new PerspectiveCamera(45, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.far = 200;
Random rand = new Random();
for (int i = 0; i < instances.length; i++) {
instances[i] = new ModelInstance(sphere, rand.nextFloat() * 100 - rand.nextFloat() * 100, rand.nextFloat() * 100
- rand.nextFloat() * 100, rand.nextFloat() * -100 - 3);
}
batch = new SpriteBatch();
font = new BitmapFont();
logo = new TextureRegion(new Texture(Gdx.files.internal("data/badlogicsmall.jpg")));
modelBatch = new ModelBatch();
}