几何、颜色与数学库
基本信息
| 属性 | 值 |
|---|---|
| 涉及包 | codechicken.lib.vec、codechicken.lib.colour、codechicken.lib.math、codechicken.lib.raytracer、codechicken.lib.lighting |
| 公开类型数 | 34(19 + 5 + 1 + 3 + 6) |
| 代表性消费者 | BlockCoord 被 ForgeMultipart import 11 次 |
功能
codechicken.lib.* 是 CodeChicken 系列的通用数学与几何底座。这一组包提供坐标、包围盒、变换、颜色、光照与射线求交。
向量与变换(codechicken.lib.vec,19 类)
| 类 | 说明 |
|---|---|
Vector3 |
三维向量 |
BlockCoord |
整数方块坐标,CCC 中使用频率最高的值类型(被 ForgeMultipart import 11 次) |
Cuboid6 |
轴对齐包围盒(6 个面),被 ForgeMultipart import 5 次 |
CuboidCoord |
包围盒整数坐标 |
Line3 |
三维线段 |
Rectangle4i |
整数矩形 |
Matrix4 / Quat / Rotation / Scale / Translation / SwapYZ |
变换基元 |
ITransformation |
变换接口 |
Transformation |
通用变换 |
TransformationList |
变换组合 |
RedundantTransformation / VariableTransformation |
特殊变换实现 |
AxisCycle |
轴循环辅助 |
IrreversibleTransformationException |
不可逆变换异常 |
颜色(codechicken.lib.colour,5 类)
| 类 | 说明 |
|---|---|
Colour |
基类 |
ColourARGB / ColourRGBA |
两种打包顺序 |
CustomGradient |
自定义渐变 |
LocalizedColours |
本地化颜色常量表,24 个 public static int 字段 |
LocalizedColours 是本条目中唯一与资源文件耦合的部分:它以 KEY_PREFIX = "codechickencore.color."(LocalizedColours.java:7)为前缀,在客户端重载时按语言文件覆盖 24 个硬编码默认值。语言键与字段一一对应且已交叉核实:en_US.lang 中 codechickencore.color.* 键恰为 24 个,与 24 个 public static int 字段数量一致。
注意键名前缀是全小写
codechickencore,与 modIdCodeChickenCore大小写不同。
数学(codechicken.lib.math,1 类)
MathHelper —— 被 ForgeMultipart import 1 次。注意它与 Minecraft 自带的 net.minecraft.util.MathHelper 同名但不同包。
射线求交(codechicken.lib.raytracer,3 类)
| 类 | 说明 |
|---|---|
RayTracer |
射线投射 |
ExtendedMOP |
扩展移动/碰撞谓词 |
IndexedCuboid6 |
带索引的包围盒 |
RayTracer 与 ExtendedMOP 各被 ForgeMultipart import 1 次。
光照(codechicken.lib.lighting,6 类)
LC(光照常量)、LightMatrix / PlanarLightMatrix、LightModel / PlanarLightModel / SimpleBrightnessModel。该组服务于 渲染管线 的顶点着色阶段。
相关条目
- 渲染管线 - 光照与顶点属性的消费方
- 世界与区块扩展 -
BlockCoord在 NBT 序列化中的用法 - CodeChicken 生态契约 - 各类的实际外部调用频次