@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());
}
java类net.minecraft.client.renderer.vertex.VertexFormat的实例源码
B3DLoader.java 文件源码
项目:CustomWorldGen
阅读 25
收藏 0
点赞 0
评论 0
ModelProgrammingPuzzle.java 文件源码
项目:pnc-repressurized
阅读 62
收藏 0
点赞 0
评论 0
@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());
}
OBJModel.java 文件源码
项目:CustomWorldGen
阅读 25
收藏 0
点赞 0
评论 0
@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());
}
B3DLoader.java 文件源码
项目:CustomWorldGen
阅读 22
收藏 0
点赞 0
评论 0
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);
}
}));
}
WorldRenderer.java 文件源码
项目:DecompiledMinecraft
阅读 24
收藏 0
点赞 0
评论 0
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());
}
}
ModelCT.java 文件源码
项目:chesttransporter
阅读 23
收藏 0
点赞 0
评论 0
@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);
}
MultiModel.java 文件源码
项目:CustomWorldGen
阅读 21
收藏 0
点赞 0
评论 0
@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());
}
ItemTextureQuadConverter.java 文件源码
项目:CustomWorldGen
阅读 22
收藏 0
点赞 0
评论 0
/**
* 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);
}
LightUtil.java 文件源码
项目:CustomWorldGen
阅读 24
收藏 0
点赞 0
评论 0
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;
}
ModelProgrammingPuzzle.java 文件源码
项目:pnc-repressurized
阅读 20
收藏 0
点赞 0
评论 0
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);
}
ModelCattailBaked.java 文件源码
项目:ExPetrum
阅读 30
收藏 0
点赞 0
评论 0
@SuppressWarnings("SameReturnValue")
public static IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
if (soilTextures == null)
{
bakeTextures(bakedTextureGetter);
bakeModels();
}
return INSTANCE;
}
ModelHandle.java 文件源码
项目:genera
阅读 24
收藏 0
点赞 0
评论 0
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();
}
MultiLayerModel.java 文件源码
项目:CustomWorldGen
阅读 25
收藏 0
点赞 0
评论 0
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();
}
WorldRenderer.java 文件源码
项目:DecompiledMinecraft
阅读 25
收藏 0
点赞 0
评论 0
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));
}
OBJModel.java 文件源码
项目:CustomWorldGen
阅读 25
收藏 0
点赞 0
评论 0
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;
}
SVertexBuilder.java 文件源码
项目:BaseClient
阅读 23
收藏 0
点赞 0
评论 0
public static void endSetVertexFormat(WorldRenderer wrr)
{
SVertexBuilder svertexbuilder = wrr.sVertexBuilder;
VertexFormat vertexformat = wrr.getVertexFormat();
svertexbuilder.vertexSize = vertexformat.getNextOffset() / 4;
svertexbuilder.hasNormal = vertexformat.hasNormal();
svertexbuilder.hasTangent = svertexbuilder.hasNormal;
svertexbuilder.hasUV = vertexformat.hasUvOffset(0);
svertexbuilder.offsetNormal = svertexbuilder.hasNormal ? vertexformat.getNormalOffset() / 4 : 0;
svertexbuilder.offsetUV = svertexbuilder.hasUV ? vertexformat.getUvOffsetById(0) / 4 : 0;
svertexbuilder.offsetUVCenter = 8;
}
ItemLayerModel.java 文件源码
项目:CustomWorldGen
阅读 24
收藏 0
点赞 0
评论 0
private static void addSideQuad(ImmutableList.Builder<BakedQuad> builder, BitSet faces, VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int uMax, int vMax, int u, int v)
{
int si = side.ordinal();
if(si > 4) si -= 2;
int index = (vMax + 1) * ((uMax + 1) * si + u) + v;
if(!faces.get(index))
{
faces.set(index);
builder.add(buildSideQuad(format, transform, side, tint, sprite, u, v));
}
}
SVertexFormat.java 文件源码
项目:BaseClient
阅读 19
收藏 0
点赞 0
评论 0
public static VertexFormat makeDefVertexFormatBlock()
{
VertexFormat vertexformat = new VertexFormat();
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
vertexformat.func_181721_a(new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
return vertexformat;
}
SVertexFormat.java 文件源码
项目:BaseClient
阅读 18
收藏 0
点赞 0
评论 0
public static VertexFormat makeDefVertexFormatTextured()
{
VertexFormat vertexformat = new VertexFormat();
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.PADDING, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
return vertexformat;
}
VertexBuffer.java 文件源码
项目:CustomWorldGen
阅读 23
收藏 0
点赞 0
评论 0
public VertexBuffer.State getVertexState()
{
this.rawIntBuffer.rewind();
int i = this.getBufferSize();
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 VertexBuffer.State(aint, new VertexFormat(this.vertexFormat));
}
ModelDynBucket.java 文件源码
项目:CustomWorldGen
阅读 22
收藏 0
点赞 0
评论 0
public BakedDynBucket(ModelDynBucket 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;
}
ModelLoader.java 文件源码
项目:CustomWorldGen
阅读 26
收藏 0
点赞 0
评论 0
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
MultipartBakedModel.Builder builder = new MultipartBakedModel.Builder();
for (Selector selector : multipart.getSelectors())
{
builder.putModel(selector.getPredicate(multipart.getStateContainer()), partModels.get(selector).bake(partModels.get(selector).getDefaultState(), format, bakedTextureGetter));
}
IBakedModel bakedModel = builder.makeMultipartModel();
return bakedModel;
}
WorldRenderer.java 文件源码
项目:BaseClient
阅读 26
收藏 0
点赞 0
评论 0
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());
if (Config.isMultiTexture())
{
if (this.blockLayer != null && this.quadSprites == null)
{
this.quadSprites = new TextureAtlasSprite[this.getBufferQuadSize()];
}
}
else
{
this.quadSprites = null;
}
}
}
WorldVertexBufferUploader.java 文件源码
项目:CustomWorldGen
阅读 18
收藏 0
点赞 0
评论 0
@SuppressWarnings("incomplete-switch")
public void draw(VertexBuffer vertexBufferIn)
{
if (vertexBufferIn.getVertexCount() > 0)
{
VertexFormat vertexformat = vertexBufferIn.getVertexFormat();
int i = vertexformat.getNextOffset();
ByteBuffer bytebuffer = vertexBufferIn.getByteBuffer();
List<VertexFormatElement> list = vertexformat.getElements();
for (int j = 0; j < list.size(); ++j)
{
VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j);
VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage();
int k = vertexformatelement.getType().getGlConstant();
int l = vertexformatelement.getIndex();
bytebuffer.position(vertexformat.getOffset(j));
// moved to VertexFormatElement.preDraw
vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer);
}
GlStateManager.glDrawArrays(vertexBufferIn.getDrawMode(), 0, vertexBufferIn.getVertexCount());
int i1 = 0;
for (int j1 = list.size(); i1 < j1; ++i1)
{
VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1);
VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage();
int k1 = vertexformatelement1.getIndex();
// moved to VertexFormatElement.postDraw
vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer);
}
}
vertexBufferIn.reset();
}
BakedQuad.java 文件源码
项目:Backmemed
阅读 25
收藏 0
点赞 0
评论 0
public BakedQuad(int[] p_i0_1_, int p_i0_2_, EnumFacing p_i0_3_, TextureAtlasSprite p_i0_4_, boolean p_i0_5_, VertexFormat p_i0_6_)
{
this.vertexData = p_i0_1_;
this.tintIndex = p_i0_2_;
this.face = p_i0_3_;
this.sprite = p_i0_4_;
this.applyDiffuseLighting = p_i0_5_;
this.format = p_i0_6_;
this.fixVertexData();
}
ItemLayerModel.java 文件源码
项目:CustomWorldGen
阅读 28
收藏 0
点赞 0
评论 0
public IBakedModel bake(IModelState state, final VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
Optional<TRSRTransformation> transform = state.apply(Optional.<IModelPart>absent());
for(int i = 0; i < textures.size(); i++)
{
TextureAtlasSprite sprite = bakedTextureGetter.apply(textures.get(i));
builder.addAll(getQuadsForSprite(i, sprite, format, transform));
}
TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
ImmutableMap<TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
return new BakedItemModel(builder.build(), particle, map, overrides, null);
}
SVertexBuilder.java 文件源码
项目:Backmemed
阅读 23
收藏 0
点赞 0
评论 0
public static void endSetVertexFormat(VertexBuffer wrr)
{
SVertexBuilder svertexbuilder = wrr.sVertexBuilder;
VertexFormat vertexformat = wrr.getVertexFormat();
svertexbuilder.vertexSize = vertexformat.getNextOffset() / 4;
svertexbuilder.hasNormal = vertexformat.hasNormal();
svertexbuilder.hasTangent = svertexbuilder.hasNormal;
svertexbuilder.hasUV = vertexformat.hasUvOffset(0);
svertexbuilder.offsetNormal = svertexbuilder.hasNormal ? vertexformat.getNormalOffset() / 4 : 0;
svertexbuilder.offsetUV = svertexbuilder.hasUV ? vertexformat.getUvOffsetById(0) / 4 : 0;
svertexbuilder.offsetUVCenter = 8;
}
BakedCosmicResonator.java 文件源码
项目:Solar
阅读 21
收藏 0
点赞 0
评论 0
public BakedCosmicResonator(VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> getter) {
super(format);
ResourceLibrary.MOON_PHASES.forEach((key, value) -> phases.put(key, getter.apply(value)));
full_moon = phases.get(FULL_MOON);
new_moon = phases.get(NEW_MOON);
eclipse = phases.get(ECLIPSE);
}
ForgeHooksClient.java 文件源码
项目:CustomWorldGen
阅读 19
收藏 0
点赞 0
评论 0
public static void postDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer)
{
VertexFormatElement attr = format.getElement(element);
switch(attrType)
{
case POSITION:
glDisableClientState(GL_VERTEX_ARRAY);
break;
case NORMAL:
glDisableClientState(GL_NORMAL_ARRAY);
break;
case COLOR:
glDisableClientState(GL_COLOR_ARRAY);
// is this really needed?
GlStateManager.resetColor();
break;
case UV:
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + attr.getIndex());
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
break;
case PADDING:
break;
case GENERIC:
glDisableVertexAttribArray(attr.getIndex());
default:
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName());
}
}
BakedGravityHopper.java 文件源码
项目:Solar
阅读 23
收藏 0
点赞 0
评论 0
public BakedGravityHopper(VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> getter) {
super(format);
for(int i = 0; i < 6; i++) {
this.overlay[i] = getter.apply(ResourceLibrary.GRAVITY_HOPPER_OVERLAY[i]);
}
this.base = getter.apply(ResourceLibrary.GRAVITY_HOPPER);
}