本文整理汇总了Java中codechicken.lib.vec.Vector3.multiply方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3.multiply方法的具体用法?Java Vector3.multiply怎么用?Java Vector3.multiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类codechicken.lib.vec.Vector3
的用法示例。
在下文中一共展示了Vector3.multiply方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import codechicken.lib.vec.Vector3; //导入方法依赖的package包/类
/**
* @param colour The pre-lighting vertex colour. RGBA format
* @param normal The normal at the vertex
* @return The lighting applied colour
*/
public int apply(int colour, Vector3 normal) {
Vector3 n_colour = ambient.copy();
for (int l = 0; l < lightCount; l++) {
Light light = lights[l];
double n_l = light.position.dotProduct(normal);
double f = n_l > 0 ? 1 : 0;
n_colour.x += light.ambient.x + f * light.diffuse.x * n_l;
n_colour.y += light.ambient.y + f * light.diffuse.y * n_l;
n_colour.z += light.ambient.z + f * light.diffuse.z * n_l;
}
if (n_colour.x > 1)
n_colour.x = 1;
if (n_colour.y > 1)
n_colour.y = 1;
if (n_colour.z > 1)
n_colour.z = 1;
n_colour.multiply((colour >>> 24) / 255D, (colour >> 16 & 0xFF) / 255D, (colour >> 8 & 0xFF) / 255D);
return (int) (n_colour.x * 255) << 24 | (int) (n_colour.y * 255) << 16 | (int) (n_colour.z * 255) << 8 | colour & 0xFF;
}
示例2: apply
import codechicken.lib.vec.Vector3; //导入方法依赖的package包/类
/**
* @param colour The pre-lighting vertex colour. RGBA format
* @param normal The normal at the vertex
* @return The lighting applied colour
*/
public int apply(int colour, Vector3 normal) {
Vector3 n_colour = ambient.copy();
for (int l = 0; l < lightCount; l++) {
Light light = lights[l];
double n_l = light.position.dotProduct(normal);
double f = n_l > 0 ? 1 : 0;
n_colour.x += light.ambient.x + f * light.diffuse.x * n_l;
n_colour.y += light.ambient.y + f * light.diffuse.y * n_l;
n_colour.z += light.ambient.z + f * light.diffuse.z * n_l;
}
if (n_colour.x > 1) {
n_colour.x = 1;
}
if (n_colour.y > 1) {
n_colour.y = 1;
}
if (n_colour.z > 1) {
n_colour.z = 1;
}
n_colour.multiply((colour >>> 24) / 255D, (colour >> 16 & 0xFF) / 255D, (colour >> 8 & 0xFF) / 255D);
return (int) (n_colour.x * 255) << 24 | (int) (n_colour.y * 255) << 16 | (int) (n_colour.z * 255) << 8 | colour & 0xFF;
}