本文整理汇总了Java中net.minecraft.client.renderer.vertex.VertexFormat类的典型用法代码示例。如果您正苦于以下问题:Java VertexFormat类的具体用法?Java VertexFormat怎么用?Java VertexFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VertexFormat类属于net.minecraft.client.renderer.vertex包,在下文中一共展示了VertexFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bake
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
for(Map.Entry<String, ResourceLocation> e : textures.entrySet())
{
if(e.getValue().getResourcePath().startsWith("#"))
{
FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), modelLocation);
builder.put(e.getKey(), missing);
}
else
{
builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue()));
}
}
builder.put("missingno", missing);
return new BakedWrapper(model.getRoot(), state, smooth, gui3d, format, meshes, builder.build());
}
示例2: bake
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的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());
}
示例3: bake
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
for (Map.Entry<String, Material> e : matLib.materials.entrySet())
{
if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#"))
{
FMLLog.severe("OBJLoader: Unresolved texture '%s' for obj model '%s'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation);
builder.put(e.getKey(), missing);
}
else
{
builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue().getTexture().getTextureLocation()));
}
}
builder.put("missingno", missing);
return new OBJBakedModel(this, state, format, builder.build());
}
示例4: BakedWrapper
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
public BakedWrapper(final Node<?> node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures)
{
this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder()
.maximumSize(128)
.expireAfterAccess(2, TimeUnit.MINUTES)
.<Integer, B3DState>build(new CacheLoader<Integer, B3DState>()
{
public B3DState load(Integer frame) throws Exception
{
IModelState parent = state;
Animation newAnimation = node.getAnimation();
if(parent instanceof B3DState)
{
B3DState ps = (B3DState)parent;
parent = ps.getParent();
}
return new B3DState(newAnimation, frame, frame, 0, parent);
}
}));
}
示例5: begin
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
public void begin(int p_181668_1_, VertexFormat p_181668_2_)
{
if (this.isDrawing)
{
throw new IllegalStateException("Already building!");
}
else
{
this.isDrawing = true;
this.reset();
this.drawMode = p_181668_1_;
this.vertexFormat = p_181668_2_;
this.field_181677_f = p_181668_2_.getElement(this.field_181678_g);
this.needsUpdate = false;
this.byteBuffer.limit(this.byteBuffer.capacity());
}
}
示例6: bake
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
try
{
IModel sub = ModelLoaderRegistry.getModel(handle);
IBakedModel baked = sub.bake(state, format, bakedTextureGetter);
return new BakedModelCH(baked, ModelRegistry.getInstance().bake(state, format, bakedTextureGetter));
} catch (Exception e)
{
e.printStackTrace();
}
return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter);
}
示例7: bake
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
IBakedModel bakedBase = null;
if (base != null)
bakedBase = base.bake(state, format, bakedTextureGetter);
ImmutableMap.Builder<String, IBakedModel> mapBuilder = ImmutableMap.builder();
for (Entry<String, Pair<IModel, IModelState>> entry : parts.entrySet())
{
Pair<IModel, IModelState> pair = entry.getValue();
mapBuilder.put(entry.getKey(), pair.getLeft().bake(new ModelStateComposition(state, pair.getRight()), format, bakedTextureGetter));
}
if(bakedBase == null && parts.isEmpty())
{
FMLLog.log(Level.ERROR, "MultiModel %s is empty (no base model or parts were provided/resolved)", location);
IModel missing = ModelLoaderRegistry.getMissingModel();
return missing.bake(missing.getDefaultState(), format, bakedTextureGetter);
}
return new Baked(location, true, bakedBase, mapBuilder.build());
}
示例8: genQuad
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
/**
* Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH.
* Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites
*/
public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, EnumFacing facing, int color)
{
float u1 = sprite.getInterpolatedU(x1);
float v1 = sprite.getInterpolatedV(y1);
float u2 = sprite.getInterpolatedU(x2);
float v2 = sprite.getInterpolatedV(y2);
x1 /= 16f;
y1 /= 16f;
x2 /= 16f;
y2 /= 16f;
float tmp = y1;
y1 = 1f - y2;
y2 = 1f - tmp;
return putQuad(format, transform, facing, sprite, color, x1, y1, x2, y2, z, u1, v1, u2, v2);
}
示例9: mapFormats
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
public static int[] mapFormats(VertexFormat from, VertexFormat to)
{
int fromCount = from.getElementCount();
int toCount = to.getElementCount();
int[] eMap = new int[fromCount];
for(int e = 0; e < fromCount; e++)
{
VertexFormatElement expected = from.getElement(e);
int e2;
for(e2 = 0; e2 < toCount; e2++)
{
VertexFormatElement current = to.getElement(e2);
if(expected.getUsage() == current.getUsage() && expected.getIndex() == current.getIndex())
{
break;
}
}
eMap[e] = e2;
}
return eMap;
}
示例10: BakedProgrammingPuzzle
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的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);
}
示例11: bake
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
@SuppressWarnings("SameReturnValue")
public static IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
if (soilTextures == null)
{
bakeTextures(bakedTextureGetter);
bakeModels();
}
return INSTANCE;
}
示例12: renderModel
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
private static void renderModel(IBakedModel model, VertexFormat fmt)
{
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, fmt);
for (BakedQuad bakedquad : model.getQuads(null, null, 0))
{
worldrenderer.addVertexData(bakedquad.getVertexData());
}
tessellator.draw();
}
示例13: buildModels
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
private static ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> buildModels(ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
ImmutableMap.Builder<Optional<BlockRenderLayer>, IBakedModel> builder = ImmutableMap.builder();
for(Optional<BlockRenderLayer> key : models.keySet())
{
IModel model = ModelLoaderRegistry.getModelOrLogError(models.get(key), "Couldn't load MultiLayerModel dependency: " + models.get(key));
builder.put(key, model.bake(new ModelStateComposition(state, model.getDefaultState()), format, bakedTextureGetter));
}
return builder.build();
}
示例14: func_181672_a
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
public WorldRenderer.State func_181672_a()
{
this.rawIntBuffer.rewind();
int i = this.func_181664_j();
this.rawIntBuffer.limit(i);
int[] aint = new int[i];
this.rawIntBuffer.get(aint);
this.rawIntBuffer.limit(this.rawIntBuffer.capacity());
this.rawIntBuffer.position(i);
return new WorldRenderer.State(aint, new VertexFormat(this.vertexFormat));
}
示例15: OBJBakedModel
import net.minecraft.client.renderer.vertex.VertexFormat; //导入依赖的package包/类
public OBJBakedModel(OBJModel model, IModelState state, VertexFormat format, ImmutableMap<String, TextureAtlasSprite> textures)
{
this.model = model;
this.state = state;
if (this.state instanceof OBJState) this.updateStateVisibilityMap((OBJState) this.state);
this.format = format;
this.textures = textures;
}