当前位置: 首页>>代码示例>>Java>>正文


Java LightUtil类代码示例

本文整理汇总了Java中net.minecraftforge.client.model.pipeline.LightUtil的典型用法代码示例。如果您正苦于以下问题:Java LightUtil类的具体用法?Java LightUtil怎么用?Java LightUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LightUtil类属于net.minecraftforge.client.model.pipeline包,在下文中一共展示了LightUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderQuads

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
public static void renderQuads(VertexBuffer renderer, List<BakedQuad> quads, int color, ItemStack stack) {
	boolean flag = (color == -1) && (!stack.isEmpty());
	int i = 0;
	for (int j = quads.size(); i < j; i++) {
		BakedQuad bakedquad = quads.get(i);
		int k = color;
		if ((flag) && (bakedquad.hasTintIndex())) {
			ItemColors itemColors = Minecraft.getMinecraft().getItemColors();
			k = itemColors.getColorFromItemstack(stack, bakedquad.getTintIndex());
			if (EntityRenderer.anaglyphEnable) {
				k = TextureUtil.anaglyphColor(k);
			}
			k |= 0xFF000000;
		}
		LightUtil.renderQuadColor(renderer, bakedquad, k);
	}
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:18,代码来源:RenderModel.java

示例2: renderQuads

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
private void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack)
{
    boolean flag = color == -1 && !stack.isEmpty();
    int i = 0;

    for (int j = quads.size(); i < j; ++i)
    {
        BakedQuad bakedquad = quads.get(i);
        int k = color;

        if (flag && bakedquad.hasTintIndex())
        {
            k = this.mc.getItemColors().getColorFromItemstack(stack, bakedquad.getTintIndex());

            if (EntityRenderer.anaglyphEnable)
                k = TextureUtil.anaglyphColor(k);
            k = k | -16777216;
        }
        LightUtil.renderQuadColor(renderer, bakedquad, k);
    }
}
 
开发者ID:Yggard,项目名称:BrokkGUI,代码行数:22,代码来源:GuiRenderItemHelper.java

示例3: renderModel

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
public static void renderModel(IBakedModel model, int color)
    {
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer buffer = tessellator.getBuffer();
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
//        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
//        GlStateManager.disableLighting();

        List<BakedQuad> quads = model.getQuads(null,null,0);

        for (BakedQuad quad : quads)
        {
            LightUtil.renderQuadColor(buffer, quad, color);
        }

        tessellator.draw();
    }
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:18,代码来源:ModelHelper.java

示例4: shadeQuadFaces

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
public static List<BakedQuad> shadeQuadFaces(List<BakedQuad> quads) {
    LinkedList<BakedQuad> shadedQuads = new LinkedList<>();
    for (BakedQuad quad : quads) {
        int[] rawData = quad.getVertexData();
        for (int v = 0; v < 4; v++) {
            for (int e = 0; e < quad.getFormat().getElementCount(); e++) {
                VertexFormatElement element = quad.getFormat().getElement(e);
                if (element.getUsage() == EnumUsage.COLOR) {
                    float[] data = new float[4];
                    LightUtil.unpack(rawData, data, quad.getFormat(), v, e);

                    data = diffuseFaceLight(quad.getFace(), data);

                    LightUtil.pack(data, rawData, quad.getFormat(), v, e);
                }
            }
        }
        shadedQuads.add(new BakedQuad(rawData, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat()));
    }

    return shadedQuads;
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:23,代码来源:VertexDataUtils.java

示例5: transformQuad

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
public final UnpackedBakedQuad transformQuad(BakedQuad quad) {
    // Fetch required information
    final VertexFormat format = quad.getFormat();
    final float[][][] vertexData = new float[4][format.getElementCount()][4];

    // Objects to be reused in the loop
    final Vector4f temp = new Vector4f();

    //unpack and transform vertex data
    for (int v = 0; v < 4; v++) {
        for (int e = 0; e < format.getElementCount(); e++) {
            LightUtil.unpack(quad.getVertexData(), vertexData[v][e], format, v, e);
            transformUnpackedVertexDataElement(format.getElement(e).getUsage(), vertexData[v][e], temp);
        }
    }
    //create new quad with the transformed vertex data
    return new UnpackedBakedQuad(vertexData, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), format);
}
 
开发者ID:InfinityRaider,项目名称:InfinityLib,代码行数:19,代码来源:TessellatorAbstractBase.java

示例6: putVertexData

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
private void putVertexData(@Nonnull Builder builder, @Nonnull Vertex v, float w) {
  VertexFormat format = builder.getVertexFormat();
  for (int e = 0; e < format.getElementCount(); e++) {
    switch (format.getElement(e).getUsage()) {
    case POSITION:
      builder.put(e, (float) v.x(), (float) v.y(), (float) v.z(), 1);
      break;
    case COLOR:
      float d = LightUtil.diffuseLight(v.nx(), v.ny(), v.nz());
      builder.put(e, d * color.x, d * color.y, d * color.z, color.w);
      break;
    case UV:
      builder.put(e, tex.getInterpolatedU(v.u() * 16) * w, tex.getInterpolatedV(v.v() * 16) * w, 0, w);
      break;
    case NORMAL:
      builder.put(e, v.nx(), v.ny(), v.nz(), 0);
      break;
    default:
      builder.put(e);
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:23,代码来源:HalfBakedQuad.java

示例7: renderModel

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
private static void renderModel(IBakedModel model, VertexFormat fmt, int color)
{
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder worldrenderer = tessellator.getBuffer();
    worldrenderer.begin(GL11.GL_QUADS, fmt);
    for (BakedQuad bakedquad : model.getQuads(null, null, 0))
    {
        LightUtil.renderQuadColor(worldrenderer, bakedquad, color);
    }
    tessellator.draw();
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:12,代码来源:ModelHandle.java

示例8: renderQuads

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
private void renderQuads(final World world, final IBlockState actualState, final BlockPos pos, final List<BakedQuad> quads, final int alpha)
{
    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder buffer = tessellator.getBuffer();

    for (final BakedQuad quad : quads)
    {
        buffer.begin(GL11.GL_QUADS, quad.getFormat());

        final int color = quad.hasTintIndex() ? this.getTint(world, actualState, pos, alpha, quad.getTintIndex()) : alpha | 0xffffff;
        LightUtil.renderQuadColor(buffer, quad, color);

        tessellator.draw();
    }
}
 
开发者ID:maruohon,项目名称:placementpreview,代码行数:16,代码来源:RenderEventHandler.java

示例9: transform

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
private static BakedQuad transform(final BakedQuad quad, final IVertexTransformer transformer)
{
    final VertexFormat format = quad.getFormat();
    final UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
    LightUtil.putBakedQuad(new VertexTransformerWrapper(builder, quad, transformer), quad);
    return builder.build();
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:8,代码来源:ModelTransformer.java

示例10: renderQuads

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
private static final void renderQuads(final List<BakedQuad> quads, final int alpha)
{
    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder buffer = tessellator.getBuffer();

    if (quads == null || quads.isEmpty())
        return;
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    quads.forEach(quad -> LightUtil.renderQuadColor(buffer, quad, alpha | 0xffffff));
    tessellator.draw();
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:12,代码来源:RenderUtil.java

示例11: checkDepth

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
protected boolean checkDepth(BakedQuad quad, Vector3 hit, EnumFacing hitFace) {
    int[] quadData = quad.getVertexData();
    VertexFormat format = quad.getFormat();
    int e = VertexDataUtils.getPositionElement(format);

    Vector3 posVec = new Vector3();
    float[] pos = new float[4];
    for (int v = 0; v < 4; v++) {
        LightUtil.unpack(quadData, pos, format, v, e);
        posVec.add(pos[0], pos[1], pos[2]);
    }
    posVec.divide(4);

    double diff = 0;
    switch (hitFace.getAxis()) {
        case X:
            diff = Math.abs(hit.x - posVec.x);
            break;
        case Y:
            diff = Math.abs(hit.y - posVec.y);
            break;
        case Z:
            diff = Math.abs(hit.z - posVec.z);
            break;
    }
    return !(diff > 0.01);
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:28,代码来源:AbstractBakedPropertiesModel.java

示例12: fullyPackQuads

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
public static void fullyPackQuads(int[] packedData, float[][][] unpackedData, VertexFormat format) {
    for (int e = 0; e < format.getElementCount(); e++) {
        for (int v = 0; v < 4; v++) {
            LightUtil.pack(unpackedData[v][e], packedData, format, v, e);
        }
    }
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:8,代码来源:VertexDataUtils.java

示例13: fullyUnPackQuads

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
public static void fullyUnPackQuads(int[] packedData, float[][][] unpackedData, VertexFormat format) {
    for (int e = 0; e < format.getElementCount(); e++) {
        for (int v = 0; v < 4; v++) {
            LightUtil.unpack(packedData, unpackedData[v][e], format, v, e);
        }
    }
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:8,代码来源:VertexDataUtils.java

示例14: renderBakedModel

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
public static void renderBakedModel(IBakedModel bakedModel) {
	Tessellator tessellator = Tessellator.getInstance();

	BufferBuilder worldrenderer = tessellator.getBuffer();
	// VertexFormat VF = new VertexFormat();
	// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);// bakedModel.getFormat());
	// OPTION A
	BakedQuad bakedQuad1 = (BakedQuad) bakedModel.getQuads(null, null, 0).get(0);

	// DARK no normal :( due to baked quad not having it worldrenderer.begin(GL11.GL_QUADS, MYFORMAT);// bakedModel.getFormat());
	worldrenderer.begin(GL11.GL_QUADS, bakedQuad1.getFormat());

	// for (BakedQuad bakedQuad : bakedModel.getQuads(null, null, 0)) {
	// worldrenderer.addVertexData(bakedQuad.getVertexData());
	//
	// }
	// alt version if ever needed

	for (BakedQuad bakedQuad : bakedModel.getQuads(null, null, 0)) {
		int j = -1;
		j = j | -16777216;
		LightUtil.renderQuadColor(worldrenderer, bakedQuad, j);

	}

	tessellator.draw();
}
 
开发者ID:TechStack,项目名称:TechStack-s-HeavyMachineryMod,代码行数:28,代码来源:MachineModModelHelper.java

示例15: computeOcclusionHash

import net.minecraftforge.client.model.pipeline.LightUtil; //导入依赖的package包/类
private int computeOcclusionHash(EnumFacing face)
{
    List<BakedQuad> quads = getQuads(face);
    QuadListKeyBuilder keyBuilder = new QuadListKeyBuilder(face);
    for(BakedQuad q : quads)
    {
        LightUtil.putBakedQuad(keyBuilder, q);
    }
    return keyBuilder.getQuadListKey();
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:11,代码来源:QuadContainer.java


注:本文中的net.minecraftforge.client.model.pipeline.LightUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。