當前位置: 首頁>>代碼示例>>Java>>正文


Java TRSRTransformation類代碼示例

本文整理匯總了Java中net.minecraftforge.common.model.TRSRTransformation的典型用法代碼示例。如果您正苦於以下問題:Java TRSRTransformation類的具體用法?Java TRSRTransformation怎麽用?Java TRSRTransformation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TRSRTransformation類屬於net.minecraftforge.common.model包,在下文中一共展示了TRSRTransformation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: apply

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
    // TODO make more use of Optional
    if(!part.isPresent())
    {
        if(parent != null)
        {
            return parent.apply(part);
        }
        return Optional.absent();
    }
    if(!(part.get() instanceof NodeJoint))
    {
        return Optional.absent();
    }
    Node<?> node = ((NodeJoint)part.get()).getNode();
    TRSRTransformation nodeTransform;
    if(progress < 1e-5 || frame == nextFrame)
    {
        nodeTransform = getNodeMatrix(node, frame);
    }
    else if(progress > 1 - 1e-5)
    {
        nodeTransform = getNodeMatrix(node, nextFrame);
    }
    else
    {
        nodeTransform = getNodeMatrix(node, frame);
        nodeTransform = nodeTransform.slerp(getNodeMatrix(node, nextFrame), progress);
    }
    if(parent != null && node.getParent() == null)
    {
        return Optional.of(parent.apply(part).or(TRSRTransformation.identity()).compose(nodeTransform));
    }
    return Optional.of(nodeTransform);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:37,代碼來源:B3DLoader.java

示例2: bake

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity());
    TextureAtlasSprite widgetSprite = bakedTextureGetter.apply(getWidgetTexture(widget));
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    int width = widget.getWidth() + (widget.getParameters() != null && widget.getParameters().length > 0 ? 10 : 0);
    int height = widget.getHeight() + (widget.hasStepOutput() ? 5 : 0);

    Pair<Double, Double> maxUV = widget.getMaxUV();
    int textureSize = widget.getTextureSize();
    float scale = 1F / (float) Math.max(maxUV.getLeft(), maxUV.getRight());
    float transX = 0;//maxUV.getLeft().floatValue();
    float transY = -1 + maxUV.getRight().floatValue();
    transform = transform.compose(new TRSRTransformation(new Vector3f(0, 0, 0), null, new Vector3f(scale, scale, 1), null));
    transform = transform.compose(new TRSRTransformation(new Vector3f(transX, transY, 0), null, new Vector3f(1, 1, 1), null));

    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), NORTH_Z_BASE, widgetSprite, EnumFacing.NORTH, 0xffffffff));
    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), SOUTH_Z_BASE, widgetSprite, EnumFacing.SOUTH, 0xffffffff));

    return new BakedProgrammingPuzzle(this, builder.build(), widgetSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap());
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:ModelProgrammingPuzzle.java

示例3: 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);
}
 
開發者ID:the-realest-stu,項目名稱:Infernum,代碼行數:17,代碼來源:ModelKnowledgeBook.java

示例4: 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);
}
 
開發者ID:the-realest-stu,項目名稱:Infernum,代碼行數:17,代碼來源:BakedModelKnowledgeBook.java

示例5: MultiLayerBakedModel

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
public MultiLayerBakedModel(ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> models, IBakedModel missing, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms)
{
    this.models = models;
    this.cameraTransforms = cameraTransforms;
    this.missing = missing;
    if(models.containsKey(Optional.absent()))
    {
        base = models.get(Optional.absent());
    }
    else
    {
        base = missing;
    }
    ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
    quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(models, Optional.<EnumFacing>absent()));
    for(EnumFacing side: EnumFacing.values())
    {
        quadBuilder.put(Optional.of(side), buildQuads(models, Optional.of(side)));
    }
    quads = quadBuilder.build();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:MultiLayerModel.java

示例6: buildQuad

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
private static final BakedQuad buildQuad(
    VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, TextureAtlasSprite sprite, int tint,
    float x0, float y0, float z0, float u0, float v0,
    float x1, float y1, float z1, float u1, float v1,
    float x2, float y2, float z2, float u2, float v2,
    float x3, float y3, float z3, float u3, float v3)
{
    UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
    builder.setQuadTint(tint);
    builder.setQuadOrientation(side);
    builder.setTexture(sprite);
    putVertex(builder, format, transform, side, x0, y0, z0, u0, v0);
    putVertex(builder, format, transform, side, x1, y1, z1, u1, v1);
    putVertex(builder, format, transform, side, x2, y2, z2, u2, v2);
    putVertex(builder, format, transform, side, x3, y3, z3, u3, v3);
    return builder.build();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:ItemLayerModel.java

示例7: getMatrix

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
@SuppressWarnings("deprecation")
public static Matrix4f getMatrix(net.minecraft.client.renderer.block.model.ItemTransformVec3f transform)
{
    javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f();
    m.setIdentity();
    m.setTranslation(TRSRTransformation.toVecmath(transform.translation));
    t.setIdentity();
    t.rotY(transform.rotation.y);
    m.mul(t);
    t.setIdentity();
    t.rotX(transform.rotation.x);
    m.mul(t);
    t.setIdentity();
    t.rotZ(transform.rotation.z);
    m.mul(t);
    t.setIdentity();
    t.m00 = transform.scale.x;
    t.m11 = transform.scale.y;
    t.m22 = transform.scale.z;
    m.mul(t);
    return m;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:ForgeHooksClient.java

示例8: apply

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
/**
 * IModelState wrapper for a Clip, sampled at specified time.
 */
public static Pair<IModelState, Iterable<Event>> apply(final IClip clip, final float lastPollTime, final float time)
{
    return Pair.<IModelState, Iterable<Event>>of(new IModelState()
    {
        public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
        {
            if(!part.isPresent() || !(part.get() instanceof IJoint))
            {
                return Optional.absent();
            }
            IJoint joint = (IJoint)part.get();
            // TODO: Cache clip application?
            TRSRTransformation jointTransform = clip.apply(joint).apply(time).compose(joint.getInvBindPose());
            Optional<? extends IJoint> parent = joint.getParent();
            while(parent.isPresent())
            {
                TRSRTransformation parentTransform = clip.apply(parent.get()).apply(time);
                jointTransform = parentTransform.compose(jointTransform);
                parent = parent.get().getParent();
            }
            return Optional.of(jointTransform);
        }
    }, clip.pastEvents(lastPollTime, time));
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:28,代碼來源:Clips.java

示例9: BakedItemModel

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TRSRTransformation> transforms, ItemOverrideList overrides, IBakedModel otherModel)
{
    this.quads = quads;
    this.particle = particle;
    this.transforms = transforms;
    this.overrides = overrides;
    if(otherModel != null)
    {
        this.otherModel = otherModel;
        this.isCulled = true;
    }
    else
    {
        ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
        for(BakedQuad quad : quads)
        {
            if(quad.getFace() == EnumFacing.SOUTH)
            {
                builder.add(quad);
            }
        }
        this.otherModel = new BakedItemModel(builder.build(), particle, transforms, overrides, this);
        isCulled = false;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:26,代碼來源:ItemLayerModel.java

示例10: putQuad

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, TextureAtlasSprite sprite, int color,
                                         float x1, float y1, float x2, float y2, float z,
                                         float u1, float v1, float u2, float v2)
{
    side = side.getOpposite();
    UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
    builder.setQuadTint(-1);
    builder.setQuadOrientation(side);
    builder.setTexture(sprite);

    if (side == EnumFacing.NORTH)
    {
        putVertex(builder, format, transform, side, x1, y1, z, u1, v2, color);
        putVertex(builder, format, transform, side, x2, y1, z, u2, v2, color);
        putVertex(builder, format, transform, side, x2, y2, z, u2, v1, color);
        putVertex(builder, format, transform, side, x1, y2, z, u1, v1, color);
    } else
    {
        putVertex(builder, format, transform, side, x1, y1, z, u1, v2, color);
        putVertex(builder, format, transform, side, x1, y2, z, u1, v1, color);
        putVertex(builder, format, transform, side, x2, y2, z, u2, v1, color);
        putVertex(builder, format, transform, side, x2, y1, z, u2, v2, color);
    }
    return builder.build();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:26,代碼來源:ItemTextureQuadConverter.java

示例11: applyTransform

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
public LinkedHashSet<Face> applyTransform(Optional<TRSRTransformation> transform)
        {
            LinkedHashSet<Face> faceSet = new LinkedHashSet<Face>();
            for (Face f : this.faces)
            {
                f.setTintIndex(getTintIndex());
//                if (minUVBounds != null && maxUVBounds != null) f.normalizeUVs(minUVBounds, maxUVBounds);
                faceSet.add(f.bake(transform.orElse(TRSRTransformation.identity())));
            }
            return faceSet;
        }
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:12,代碼來源:TintedOBJModel.java

示例12: BakedProgrammingPuzzle

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
public BakedProgrammingPuzzle(ModelProgrammingPuzzle parent, ImmutableList<BakedQuad> quads,
                              TextureAtlasSprite particle, VertexFormat format,
                              ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms,
                              Map<String, IBakedModel> cache) {
    this.quads = quads;
    this.particle = particle;
    this.format = format;
    this.parent = parent;
    this.transforms = transforms;
    this.cache = cache;
    this.overridesList = new PuzzleOverrideList(Collections.emptyList(), this);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:13,代碼來源:ModelProgrammingPuzzle.java

示例13: getModel

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
public static IBakedModel getModel(ResourceLocation resourceLocation) 
{
	IBakedModel bakedModel;
	IModel model;
	try {
        model = ModelLoaderRegistry.getModel(resourceLocation);
	} catch (Exception e) {
         throw new RuntimeException(e);
	}
	bakedModel = model.bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK,
			location -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()));
    return bakedModel;
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:14,代碼來源:HarshenClientUtils.java

示例14: getBakedModel

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
public static IBakedModel getBakedModel(String modelLocation){

        IModel model;
        try {
            model = ModelLoaderRegistry.getModel(new ResourceLocation(RunicArcana.MOD_ID, modelLocation));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        IBakedModel bakedModel = model.bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, DustModelHandler::textureGetter);

        return bakedModel;
    }
 
開發者ID:Drazuam,項目名稱:RunicArcana,代碼行數:14,代碼來源:DustModelHandler.java

示例15: bake

import net.minecraftforge.common.model.TRSRTransformation; //導入依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	IBakedModel[] connections = new IBakedModel[6];
	IBakedModel[] endings = new IBakedModel[6];
	IBakedModel[] nodeSides = new IBakedModel[6];
	//IBakedModel node = null;

	// d u n s w e
	ModelRotation[] rotations = new ModelRotation[] { ModelRotation.X90_Y0, ModelRotation.X270_Y0,
			ModelRotation.X0_Y0, ModelRotation.X0_Y180, ModelRotation.X0_Y270, ModelRotation.X0_Y90 };

	try {
		IModel nodeSideModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_node_side"));
		IModel connectionModel = ModelLoaderRegistry
				.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_connection"));
		IModel endingModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_end"));

		//node = nodeModel.bake(new TRSRTransformation(ModelRotation.X0_Y0), DefaultVertexFormats.BLOCK,
		//		ModelLoader.defaultTextureGetter());
		for (int i = 0; i < connections.length; i++) {
			connections[i] = connectionModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
			endings[i] = endingModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
			nodeSides[i] = nodeSideModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
		}
	} catch (Exception e) {
		Etheric.logger.warn(e.getMessage());
	}

	if (connections[0] == null) {
		return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter);
	}
	return new BakedPipeModel(nodeSides, connections, endings);
}
 
開發者ID:the-realest-stu,項目名稱:Etheric,代碼行數:38,代碼來源:PipeModel.java


注:本文中的net.minecraftforge.common.model.TRSRTransformation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。