本文整理汇总了Java中codechicken.lib.lighting.LightModel类的典型用法代码示例。如果您正苦于以下问题:Java LightModel类的具体用法?Java LightModel怎么用?Java LightModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LightModel类属于codechicken.lib.lighting包,在下文中一共展示了LightModel类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import codechicken.lib.lighting.LightModel; //导入依赖的package包/类
public static void init()
{
INSTANCE = new RenderGlowPanel();
TextureUtils.addIconRegistrar(INSTANCE);
Map<String, CCModel> models = CCModel.parseObjModels(MekanismUtils.getResource(ResourceType.MODEL, "glow_panel.obj"), 7, null);
frameModels = new CCModel[6];
frameModels[0] = models.get("frame").backfacedCopy().apply(Vector3.center.translation()).shrinkUVs(0.0005);
CCModel.generateSidedModels(frameModels, 0, Vector3.center);
lightModels = new CCModel[6];
lightModels[0] = models.get("light").backfacedCopy().apply(Vector3.center.translation()).shrinkUVs(0.0005);
CCModel.generateSidedModels(lightModels, 0, Vector3.center);
for(CCModel c : frameModels)
{
c.computeLighting(LightModel.standardLightModel);
}
}
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:21,代码来源:RenderGlowPanel.java
示例2: computeLighting
import codechicken.lib.lighting.LightModel; //导入依赖的package包/类
/**
* Computes lighting using the normals add a light model
* If the model is rotated, the lighting will no longer be valid
* @return The model
*/
public CCModel computeLighting(LightModel light)
{
Vector3[] normals = normals();
int[] colours = getAttributes(CCRenderState.lightingAttrib);
if(colours == null) {
colours = getOrAllocate(CCRenderState.lightingAttrib);
Arrays.fill(colours, -1);
}
for(int k = 0; k < verts.length; k++)
colours[k] = light.apply(colours[k], normals[k]);
return this;
}
开发者ID:4Space,项目名称:4Space-5,代码行数:18,代码来源:CCModel.java
示例3: computeLighting
import codechicken.lib.lighting.LightModel; //导入依赖的package包/类
/**
* Computes lighting using the normals add a light model
* If the model is rotated, the lighting will no longer be valid
*
* @return The model
*/
public CCModel computeLighting(LightModel light) {
Vector3[] normals = normals();
int[] colours = getAttributes(LightingAttribute.attributeKey);
if (colours == null) {
colours = getOrAllocate(LightingAttribute.attributeKey);
Arrays.fill(colours, -1);
}
for (int k = 0; k < verts.length; k++) {
colours[k] = light.apply(colours[k], normals[k]);
}
return this;
}
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:19,代码来源:CCModel.java
示例4: computeLighting
import codechicken.lib.lighting.LightModel; //导入依赖的package包/类
/**
* Computes lighting using the normals add a light model
* If the model is rotated, the lighting will no longer be valid
*
* @return The model
*/
public CCModel computeLighting(LightModel light)
{
Vector3[] normals = normals();
int[] colours = getAttributes(CCRenderState.lightingAttrib);
if (colours == null)
{
colours = getOrAllocate(CCRenderState.lightingAttrib);
Arrays.fill(colours, -1);
}
for (int k = 0; k < verts.length; k++)
colours[k] = light.apply(colours[k], normals[k]);
return this;
}
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:20,代码来源:CCModel.java
示例5: renderQuad
import codechicken.lib.lighting.LightModel; //导入依赖的package包/类
private static void renderQuad(BakedQuad quad, IBlockAccess world, IBlockState state, BlockPos pos, VertexBuffer buffer, long rand, boolean useAO) {
AOLightMatrix matrix = new AOLightMatrix();
matrix.locate(world, pos, useAO);
CCQuad ccQuad = new CCQuad(quad);
ccQuad.quadulate();
ccQuad.computeNormals();
VertexFormat format = buffer.getVertexFormat();
BlockColors colours = Minecraft.getMinecraft().getBlockColors();
LightModel lightModel = quad.shouldApplyDiffuseLighting() ? standardLightModel : noDifuseLightModel;
int quadTintRenderPass = quad.getTintIndex();
int tintMultiplier = -1;
if (quadTintRenderPass != -1) {
tintMultiplier = colours.colorMultiplier(state, world, pos, quadTintRenderPass);
}
for (int v = 0; v < 4; v++) {
Vertex5 vert = ccQuad.vertices[v].copy();
Vector3 normal = ccQuad.normals[v].copy();
Colour colour = ccQuad.colours[v].copy().multiply(new ColourRGBA(lightModel.apply(tintMultiplier, normal)));
LC lc = new LC();
lc.compute(vert.vec, normal);
TripleABC<Integer, Integer, ?> lm = matrix.apply(lc, colour);
int finalColour = lm.getA();
int brightness = lm.getB();
for (int e = 0; e < format.getElementCount(); e++) {
VertexFormatElement element = format.getElement(e);
switch (element.getUsage()){
case POSITION:
buffer.pos(vert.vec.x, vert.vec.y, vert.vec.z);
break;
case UV:
if (element.getIndex() == 0) {
buffer.tex(vert.uv.u, vert.uv.v);
} else {
buffer.lightmap(brightness >> 16 & 65535, brightness & 65535);
}
break;
case COLOR:
buffer.color(finalColour >>> 24, finalColour >> 16 & 0xFF, finalColour >> 8 & 0xFF, finalColour & 0xFF);
break;
case NORMAL:
buffer.normal((float) normal.x, (float) normal.y, (float) normal.z);
break;
case PADDING:
break;
default:
throw new UnsupportedOperationException("Generic vertex format element");
}
}
buffer.endVertex();
}
buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
}
开发者ID:TheCBProject,项目名称:CCTweaks,代码行数:53,代码来源:RenderHooks.java
注:本文中的codechicken.lib.lighting.LightModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论