当前位置: 首页>>代码示例>>Java>>正文


Java Bezier类代码示例

本文整理汇总了Java中com.badlogic.gdx.math.Bezier的典型用法代码示例。如果您正苦于以下问题:Java Bezier类的具体用法?Java Bezier怎么用?Java Bezier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Bezier类属于com.badlogic.gdx.math包,在下文中一共展示了Bezier类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHighestBezierValue

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
public static Vector2 getHighestBezierValue(float[] c) {
	Vector2 p0 = new Vector2(c[0], c[1]);
	Vector2 p1 = new Vector2(c[2], c[3]);
	Vector2 p2 = new Vector2(c[4], c[5]);
	Vector2 p3 = new Vector2(c[6], c[7]);
	float y = 0;
	float x = 0;
	for (float i = 0; i < 1; i += 0.01f) {
		Vector2 v = Bezier.cubic(new Vector2(), i, p0, p1, p2, p3, new Vector2());
		if (v.y > y) {
			x = i;
			y = v.y;
		}
	}
	
	return new Vector2(x, y);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:18,代码来源:Generator.java

示例2: EnterPlanetAnimation

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
public EnterPlanetAnimation(PerspectiveCamera camera, Rocket rocket, OverlayRenderer overlayRenderer, AnimationFinishedListener listener) {
	super(3000, listener);
	this.camera = camera;
	this.rocket = rocket;
	this.overlayRenderer = overlayRenderer;

	camera.up.set(Vector3.Z);

	exitPath = new Bezier<Vector3>();
	exitPath.set(
			new Vector3(-300, 0, 280),
			new Vector3(-30, 0, 140),
			new Vector3(20, 0, 110));
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:15,代码来源:EnterPlanetAnimation.java

示例3: ExitPlanetAnimation

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
public ExitPlanetAnimation(PerspectiveCamera camera, Rocket rocket, OverlayRenderer overlayRenderer, AnimationFinishedListener listener) {
	super(3000, listener);
	this.camera = camera;
	this.rocket = rocket;
	this.overlayRenderer = overlayRenderer;
	this.baseFieldOfView = camera.fieldOfView;
	rocket.setThirdPersonCam(null);
	exitPath = new Bezier<Vector3>();
	exitPath.set(
			new Vector3(20, 0, 110),
			new Vector3(-30, 0, 140),
			new Vector3(-300, 0, 280));
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:14,代码来源:ExitPlanetAnimation.java

示例4: renderChar

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
private void renderChar(BitmapFont font, Color color, Vector2 offset, float t, float alpha) {
    color.a = alpha;
    Bezier.quadratic(temp2, t, start, control, end, temp1);
    temp2.add(offset);
    font.setColor(color);
    font.setScale(0.5f + t * 0.5f);
    font.draw(DrawUtil.batch, text, temp2.x, temp2.y);
}
 
开发者ID:GameDevWeek,项目名称:CodeBase,代码行数:9,代码来源:TextChar.java

示例5: create

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
@Override
public void create () {
	renderer = new ImmediateModeRenderer20(false, false, 0);
	spriteBatch = new SpriteBatch();
	obj = new Sprite(new Texture(Gdx.files.internal("data/badlogicsmall.jpg")));
	obj.setSize(40, 40);
	obj.setOriginCenter();
	obj2 = new Sprite(new Texture(Gdx.files.internal("data/bobrgb888-32x32.png")));
	obj2.setSize(40, 40);
	obj2.setOriginCenter();
	ZIGZAG_SCALE = Gdx.graphics.getDensity() * 96; // 96DP

	float w = Gdx.graphics.getWidth() - obj.getWidth();
	float h = Gdx.graphics.getHeight() - obj.getHeight();

	paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(w, h)));
	paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(0, h), new Vector2(w, h)));
	paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(w, 0), new Vector2(0, h), new Vector2(w, h)));

	Vector2 cp[] = new Vector2[] {new Vector2(0, 0), new Vector2(w * 0.25f, h * 0.5f), new Vector2(0, h),
		new Vector2(w * 0.5f, h * 0.75f), new Vector2(w, h), new Vector2(w * 0.75f, h * 0.5f), new Vector2(w, 0),
		new Vector2(w * 0.5f, h * 0.25f)};
	paths.add(new BSpline<Vector2>(cp, 3, true));

	paths.add(new CatmullRomSpline<Vector2>(cp, true));

	pathLength = paths.get(currentPath).approxLength(500);
	avg_speed = speed * pathLength;

	Gdx.input.setInputProcessor(this);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:32,代码来源:PathTest.java

示例6: create

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
@Override
public void create() {
	try {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	} catch (Exception e) {
		e.printStackTrace();
	}
	stage = new Stage(new ScreenViewport());
	fontBatch = new SpriteBatch();
	
	font = new BitmapFont();
	assets = new AssetManager();
	assets.load("img/gui/knob.png", Texture.class);
	assets.finishLoading();
	
	skin = new Skin(Gdx.files.internal("skin/default/uiskin.json"));
	skin.add("knob", assets.get("img/gui/knob.png", Texture.class));
	
	knobs = new Image[4];
	renderer = new ImmediateModeRenderer20(false, false, 0);
	
	Vector2[] v = new Vector2[4];
	Vector2[] w = new Vector2[4];
	
	for (int i = 0; i < knobs.length; i++) {
		knobs[i] = new Image(skin.getDrawable("knob"));
		knobs[i].setPosition(startPos[i].x, startPos[i].y);
		stage.addActor(knobs[i]);
		v[i] = new Vector2(startPos[i].x, startPos[i].y);
		w[i] = new Vector2((startPos[i].x - X) / SIZE, (startPos[i].y - X) / SIZE);
	}
	
	bezier = new Bezier<Vector2>(v);
	bezierLogic = new Bezier<Vector2>(w);
	
	stage.addListener(this);
	stage.getCamera().rotate(Vector3.Z, -270);
	
	Gdx.input.setInputProcessor(stage);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:41,代码来源:BezierEditor.java

示例7: generateBezier

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
public static void generateBezier(Island island, float[] c, int x, int z, int radius, int off, int h, byte[] b, boolean force) {
	Vector2 p0 = new Vector2(c[0], c[1]);
	Vector2 p1 = new Vector2(c[2], c[3]);
	Vector2 p2 = new Vector2(c[4], c[5]);
	Vector2 p3 = new Vector2(c[6], c[7]);
	for (int i = 0; i < h; i++) {
		float t = i / (float) h;
		
		float rad = (float) Math.floor(radius * Bezier.cubic(new Vector2(), t, p0, p1, p2, p3, new Vector2()).y);
		fillHorizontalCircle(island, x, off - i, z, rad, b, force);
	}
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:13,代码来源:Generator.java

示例8: getBezierValue

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
/**
 * [0 - 1]
 */
public static float getBezierValue(float[] c, float x) {
	Vector2 p0 = new Vector2(c[0], c[1]);
	Vector2 p1 = new Vector2(c[2], c[3]);
	Vector2 p2 = new Vector2(c[4], c[5]);
	Vector2 p3 = new Vector2(c[6], c[7]);
	
	return Bezier.cubic(new Vector2(), x, p0, p1, p2, p3, new Vector2()).y;
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:12,代码来源:Generator.java

示例9: write

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
@Override
public void write(Kryo kryo, Output output, Bezier bezier) {
    kryo.writeObjectOrNull(output, bezier.points, Array.class);
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:5,代码来源:BezierSerializer.java

示例10: read

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
@Override
public Bezier read(Kryo kryo, Input input, Class<Bezier> type) {
    Bezier bezier = new Bezier();
    bezier.points = kryo.readObjectOrNull(input, Array.class);
    return bezier;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:7,代码来源:BezierSerializer.java

示例11: RulePathFollow

import com.badlogic.gdx.math.Bezier; //导入依赖的package包/类
public RulePathFollow(Bezier<Vector3> curve){
	this(curve, 1.0f);
}
 
开发者ID:urstruktur,项目名称:zierfisch,代码行数:4,代码来源:RulePathFollow.java


注:本文中的com.badlogic.gdx.math.Bezier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。