本文整理匯總了Java中net.minecraftforge.common.model.TRSRTransformation.getMatrix方法的典型用法代碼示例。如果您正苦於以下問題:Java TRSRTransformation.getMatrix方法的具體用法?Java TRSRTransformation.getMatrix怎麽用?Java TRSRTransformation.getMatrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.common.model.TRSRTransformation
的用法示例。
在下文中一共展示了TRSRTransformation.getMatrix方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handlePerspective
import net.minecraftforge.common.model.TRSRTransformation; //導入方法依賴的package包/類
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
if (baseSpellPageModel instanceof IPerspectiveAwareModel) {
Matrix4f matrix4f = ((IPerspectiveAwareModel) baseSpellPageModel).handlePerspective(cameraTransformType)
.getRight();
return Pair.of(this, matrix4f);
}
ItemCameraTransforms itemCameraTransforms = baseSpellPageModel.getItemCameraTransforms();
ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
Matrix4f mat = null;
if (tr != null) {
mat = tr.getMatrix();
}
return Pair.of(this, mat);
}
示例2: handlePerspective
import net.minecraftforge.common.model.TRSRTransformation; //導入方法依賴的package包/類
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
if (baseKnowledgeBookModel instanceof IPerspectiveAwareModel) {
Matrix4f matrix4f = ((IPerspectiveAwareModel) baseKnowledgeBookModel).handlePerspective(cameraTransformType)
.getRight();
return Pair.of(this, matrix4f);
}
ItemCameraTransforms itemCameraTransforms = baseKnowledgeBookModel.getItemCameraTransforms();
ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
Matrix4f mat = null;
if (tr != null) {
mat = tr.getMatrix();
}
return Pair.of(this, mat);
}
示例3: handlePerspective
import net.minecraftforge.common.model.TRSRTransformation; //導入方法依賴的package包/類
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
if (parentModel instanceof IPerspectiveAwareModel) {
Matrix4f matrix4f = ((IPerspectiveAwareModel) parentModel).handlePerspective(cameraTransformType)
.getRight();
return Pair.of(this, matrix4f);
}
ItemCameraTransforms itemCameraTransforms = parentModel.getItemCameraTransforms();
ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
Matrix4f mat = null;
if (tr != null) {
mat = tr.getMatrix();
}
return Pair.of(this, mat);
}
示例4: bake
import net.minecraftforge.common.model.TRSRTransformation; //導入方法依賴的package包/類
public Face bake(TRSRTransformation transform)
{
Matrix4f m = transform.getMatrix();
Matrix3f mn = null;
Vertex[] vertices = new Vertex[verts.length];
// Normal[] normals = norms != null ? new Normal[norms.length] : null;
// TextureCoordinate[] textureCoords = texCoords != null ? new TextureCoordinate[texCoords.length] : null;
for (int i = 0; i < verts.length; i++)
{
Vertex v = verts[i];
// Normal n = norms != null ? norms[i] : null;
// TextureCoordinate t = texCoords != null ? texCoords[i] : null;
Vector4f pos = new Vector4f(v.getPos()), newPos = new Vector4f();
pos.w = 1;
m.transform(pos, newPos);
vertices[i] = new Vertex(newPos, v.getMaterial());
if (v.hasNormal())
{
if(mn == null)
{
mn = new Matrix3f();
m.getRotationScale(mn);
mn.invert();
mn.transpose();
}
Vector3f normal = new Vector3f(v.getNormal().getData()), newNormal = new Vector3f();
mn.transform(normal, newNormal);
newNormal.normalize();
vertices[i].setNormal(new Normal(newNormal));
}
if (v.hasTextureCoordinate()) vertices[i].setTextureCoordinate(v.getTextureCoordinate());
else v.setTextureCoordinate(TextureCoordinate.getDefaultUVs()[i]);
//texCoords TODO
// if (t != null) textureCoords[i] = t;
}
Face newFace = new Face(vertices, this.materialName);
newFace.setTintIndex(tintIndex);
return newFace;
}