本文整理匯總了Java中javax.vecmath.Matrix4f.setTranslation方法的典型用法代碼示例。如果您正苦於以下問題:Java Matrix4f.setTranslation方法的具體用法?Java Matrix4f.setTranslation怎麽用?Java Matrix4f.setTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.vecmath.Matrix4f
的用法示例。
在下文中一共展示了Matrix4f.setTranslation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rebake
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
private static BakedModelKnowledgeBook rebake(ModelKnowledgeBook model, String name) {
Matrix4f m = new Matrix4f();
m.m20 = 1f / 128f;
m.m01 = m.m12 = -m.m20;
m.m33 = 1;
Matrix3f rotation = new Matrix3f();
m.getRotationScale(rotation);
Matrix3f angleZ = new Matrix3f();
angleZ.rotZ(-1.5708F);
rotation.mul(rotation, angleZ);
m.setRotationScale(rotation);
m.setScale(0.66666666667F * m.getScale());
m.setTranslation(new Vector3f(0.1875F, 0.2505F, 0.125F));
SimpleModelFontRenderer fontRenderer = new SimpleModelFontRenderer(Minecraft.getMinecraft().gameSettings, font, Minecraft.getMinecraft().getTextureManager(), false, m, DefaultVertexFormats.ITEM) {
@Override
protected float renderUnicodeChar(char c, boolean italic) {
return super.renderDefaultChar(126, italic);
}
};
int maxLineWidth = 96;
TextureAtlasSprite fontSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(font2.toString());
List<BakedQuad> textQuads = new ArrayList<BakedQuad>();
fontRenderer.setSprite(fontSprite);
fontRenderer.setFillBlanks(false);
int yOffset = 2;
String title = I18n.translateToLocal(name);
List<String> lines = fontRenderer.listFormattedStringToWidth(title, maxLineWidth);
for (int line = 0; line < lines.size(); line++) {
int offset = ((maxLineWidth - fontRenderer.getStringWidth(lines.get(line))) / 2);
fontRenderer.drawString(lines.get(line), offset, yOffset, 0x00000000);
yOffset += (fontRenderer.FONT_HEIGHT - 1 + 4);
}
textQuads.addAll(fontRenderer.build());
return new BakedModelKnowledgeBook(model, textQuads);
}
示例2: getMatrix
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public void getMatrix(Matrix4f matrix, float time) {
matrix.setIdentity();
Matrix4f rot = new Matrix4f();
for(SkyLayerRotation roti : rotation) {
roti.getMatrix(rot, time);
matrix.mul(rot);
}
matrix.setTranslation(new Vector3f(offset[0], offset[1], offset[2]));
matrix.setScale(scale);
}
示例3: rebake
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
private static BakedModelSpellPage rebake(ModelSpellPage model, Spell spell) {
Matrix4f m = new Matrix4f();
m.m20 = 1f / 128f;
m.m01 = m.m12 = -m.m20;
m.m33 = 1;
Matrix3f rotation = new Matrix3f();
m.getRotationScale(rotation);
Matrix3f angle = new Matrix3f();
angle.rotZ(1.5708F);
rotation.mul(rotation, angle);
m.setRotationScale(rotation);
m.setScale(0.75F * m.getScale());
m.setTranslation(new Vector3f(0.8625F, 0.095F, 0.8625F));
SimpleModelFontRenderer fontRenderer = new SimpleModelFontRenderer(Minecraft.getMinecraft().gameSettings, font, Minecraft.getMinecraft().getTextureManager(), false, m, DefaultVertexFormats.ITEM) {
@Override
protected float renderUnicodeChar(char c, boolean italic) {
return super.renderDefaultChar(126, italic);
}
};
TextureAtlasSprite fontSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(font2.toString());
List<BakedQuad> textQuads = new ArrayList<BakedQuad>();
fontRenderer.setSprite(fontSprite);
fontRenderer.setFillBlanks(false);
String name = TextFormatting.BOLD + I18n.translateToLocal(spell.getUnlocalizedName() + ".name");
String text = I18n.translateToLocal(spell.getUnlocalizedName() + ".desc");
String castingType = "--" + I18n.translateToLocal(spell.getCastingType().getName() + ".name") + "--";
int yOffset = 0;
fontRenderer.drawString(name, (126 - fontRenderer.getStringWidth(name)) / 2, yOffset, 0x007A0000);
yOffset += (fontRenderer.FONT_HEIGHT + 1);
List<String> lines = fontRenderer.listFormattedStringToWidth(text, 126);
for (int line = 0; line < lines.size(); line++) {
int offset = ((126 - fontRenderer.getStringWidth(lines.get(line))) / 2);
fontRenderer.drawString(lines.get(line), offset, yOffset, 0x004F0000);
yOffset += fontRenderer.FONT_HEIGHT;
}
yOffset += 5;
fontRenderer.drawString(castingType, (126 - fontRenderer.getStringWidth(castingType)) / 2, yOffset, 0x00210000);
textQuads.addAll(fontRenderer.build());
return new BakedModelSpellPage(model, textQuads);
}