mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-16 01:54:50 +00:00
Initial Commit
This commit is contained in:
1 parent
397135f687
commit
0f32dd8620
82 files changed
+10693
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package codechicken.lib.lighting;
|
||||
|
||||
import codechicken.lib.render.CCModel;
|
||||
import codechicken.lib.render.Vertex5;
|
||||
|
||||
public class CCRBModel extends CCModel
|
||||
{
|
||||
public LC[] lightCoefficents;
|
||||
|
||||
/**
|
||||
* Lighting sides and coefficients are computed for each vertex of the model. All faces must be axis planar and all verts are assumed to be in the range (0,0,0) to (1,1,1)
|
||||
*/
|
||||
public CCRBModel(CCModel m)
|
||||
{
|
||||
super(m.vertexMode);
|
||||
verts = new Vertex5[m.verts.length];
|
||||
copy(m, 0, this, 0, m.verts.length);
|
||||
if(normals == null)
|
||||
computeNormals();
|
||||
if(colours == null)
|
||||
setColour(-1);
|
||||
computeLighting();
|
||||
}
|
||||
|
||||
private void computeLighting()
|
||||
{
|
||||
lightCoefficents = new LC[verts.length];
|
||||
for(int k = 0; k < verts.length; k++)
|
||||
lightCoefficents[k] = LC.compute(verts[k].vec, normals[k]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user