mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 22:27:41 +00:00
BabeDead update for Blender 2.77 light falloff
This commit is contained in:
@@ -49,6 +49,7 @@ void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
|
||||
os.format("lamp.retro_layer = %u\n"
|
||||
"lamp.retro_origtype = %u\n"
|
||||
"lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n"
|
||||
"lamp.use_nodes = True\n"
|
||||
"falloff_node = lamp.node_tree.nodes.new('ShaderNodeLightFalloff')\n"
|
||||
"lamp.energy = 0.0\n"
|
||||
@@ -68,12 +69,15 @@ void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
case BabeDeadLight::Falloff::Constant:
|
||||
os << "falloff_node.inputs[0].default_value *= 75.0\n"
|
||||
"lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||
os.format("lamp.constant_coefficient = 2.0 / %f\n", light.q);
|
||||
break;
|
||||
case BabeDeadLight::Falloff::Linear:
|
||||
os << "lamp.node_tree.links.new(falloff_node.outputs[1], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||
os.format("lamp.linear_coefficient = 250 / %f\n", light.q);
|
||||
break;
|
||||
case BabeDeadLight::Falloff::Quadratic:
|
||||
os << "lamp.node_tree.links.new(falloff_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||
os.format("lamp.quadratic_coefficient = 25000 / %f\n", light.q);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -32,19 +32,20 @@ static void BoxFilter(const uint8_t* input, unsigned chanCount,
|
||||
int y,x,c;
|
||||
for (y=0 ; y<mipHeight ; ++y)
|
||||
{
|
||||
unsigned mip_line_base = mipWidth * y;
|
||||
unsigned in1_line_base = inWidth * (y*2);
|
||||
unsigned in2_line_base = inWidth * (y*2+1);
|
||||
unsigned miplineBase = mipWidth * y;
|
||||
unsigned in1LineBase = inWidth * (y*2);
|
||||
unsigned in2LineBase = inWidth * (y*2+1);
|
||||
for (x=0 ; x<mipWidth ; ++x)
|
||||
{
|
||||
uint8_t* out = &output[(mip_line_base+x)*chanCount];
|
||||
uint8_t* out = &output[(miplineBase+x)*chanCount];
|
||||
for (c=0 ; c<chanCount ; ++c)
|
||||
{
|
||||
out[c] = 0;
|
||||
out[c] += input[(in1_line_base+(x*2))*chanCount+c] / 4;
|
||||
out[c] += input[(in1_line_base+(x*2+1))*chanCount+c] / 4;
|
||||
out[c] += input[(in2_line_base+(x*2))*chanCount+c] / 4;
|
||||
out[c] += input[(in2_line_base+(x*2+1))*chanCount+c] / 4;
|
||||
uint32_t tmp = 0;
|
||||
tmp += input[(in1LineBase+(x*2))*chanCount+c];
|
||||
tmp += input[(in1LineBase+(x*2+1))*chanCount+c];
|
||||
tmp += input[(in2LineBase+(x*2))*chanCount+c];
|
||||
tmp += input[(in2LineBase+(x*2+1))*chanCount+c];
|
||||
out[c] = tmp / 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user