clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`. `clang-format` developers seem to mostly care about space-based indentation and every other version of clang-format breaks the bad mismatch of tabs and spaces that it seems to use for operand alignment. So it's better without, so that it respects our two-tabs `ContinuationIndentWidth`.
This commit is contained in:
parent
8508f9396d
commit
3b11e33a09
95 changed files with 649 additions and 645 deletions
|
|
@ -495,8 +495,7 @@ void GodotBodyPair3D::solve(real_t p_step) {
|
|||
Vector3 temp1 = inv_inertia_tensor_A.xform(c.rA.cross(tv));
|
||||
Vector3 temp2 = inv_inertia_tensor_B.xform(c.rB.cross(tv));
|
||||
|
||||
real_t t = -tvl /
|
||||
(inv_mass_A + inv_mass_B + tv.dot(temp1.cross(c.rA) + temp2.cross(c.rB)));
|
||||
real_t t = -tvl / (inv_mass_A + inv_mass_B + tv.dot(temp1.cross(c.rA) + temp2.cross(c.rB)));
|
||||
|
||||
Vector3 jt = t * tv;
|
||||
|
||||
|
|
@ -863,8 +862,7 @@ void GodotBodySoftBodyPair3D::solve(real_t p_step) {
|
|||
|
||||
Vector3 temp1 = body_inv_inertia_tensor.xform(c.rA.cross(tv));
|
||||
|
||||
real_t t = -tvl /
|
||||
(body_inv_mass + node_inv_mass + tv.dot(temp1.cross(c.rA)));
|
||||
real_t t = -tvl / (body_inv_mass + node_inv_mass + tv.dot(temp1.cross(c.rA)));
|
||||
|
||||
Vector3 jt = t * tv;
|
||||
|
||||
|
|
|
|||
|
|
@ -129,16 +129,18 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
|||
plane_space(normal[0], normal[1], normal[2]);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
memnew_placement(&m_jac[i], GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
pivotBInW - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normal[i],
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
memnew_placement(
|
||||
&m_jac[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
pivotBInW - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normal[i],
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -192,8 +194,7 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
|||
real_t swingAxisSign = (b2Axis1.dot(b1Axis1) >= 0.0f) ? 1.0f : -1.0f;
|
||||
m_swingAxis *= swingAxisSign;
|
||||
|
||||
m_kSwing = real_t(1.) / (A->compute_angular_impulse_denominator(m_swingAxis) +
|
||||
B->compute_angular_impulse_denominator(m_swingAxis));
|
||||
m_kSwing = real_t(1.) / (A->compute_angular_impulse_denominator(m_swingAxis) + B->compute_angular_impulse_denominator(m_swingAxis));
|
||||
}
|
||||
|
||||
// Twist limits
|
||||
|
|
@ -212,8 +213,7 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
|||
m_twistAxis.normalize();
|
||||
m_twistAxis *= -1.0f;
|
||||
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) +
|
||||
B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
|
||||
} else if (twist > m_twistSpan * lockedFreeFactor) {
|
||||
m_twistCorrection = (twist - m_twistSpan);
|
||||
|
|
@ -222,8 +222,7 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
|||
m_twistAxis = (b2Axis1 + b1Axis1) * 0.5f;
|
||||
m_twistAxis.normalize();
|
||||
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) +
|
||||
B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,25 +279,30 @@ void GodotGeneric6DOFJoint3D::calculateTransforms() {
|
|||
void GodotGeneric6DOFJoint3D::buildLinearJacobian(
|
||||
GodotJacobianEntry3D &jacLinear, const Vector3 &normalWorld,
|
||||
const Vector3 &pivotAInW, const Vector3 &pivotBInW) {
|
||||
memnew_placement(&jacLinear, GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
pivotBInW - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normalWorld,
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
memnew_placement(
|
||||
&jacLinear,
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
pivotBInW - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normalWorld,
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
}
|
||||
|
||||
void GodotGeneric6DOFJoint3D::buildAngularJacobian(
|
||||
GodotJacobianEntry3D &jacAngular, const Vector3 &jointAxisW) {
|
||||
memnew_placement(&jacAngular, GodotJacobianEntry3D(jointAxisW,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
memnew_placement(
|
||||
&jacAngular,
|
||||
GodotJacobianEntry3D(
|
||||
jointAxisW,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
}
|
||||
|
||||
bool GodotGeneric6DOFJoint3D::testAngularLimitMotor(int axis_index) {
|
||||
|
|
|
|||
|
|
@ -149,16 +149,18 @@ bool GodotHingeJoint3D::setup(real_t p_step) {
|
|||
plane_space(normal[0], normal[1], normal[2]);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
memnew_placement(&m_jac[i], GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
pivotBInW - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normal[i],
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
memnew_placement(
|
||||
&m_jac[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
pivotBInW - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normal[i],
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,23 +177,32 @@ bool GodotHingeJoint3D::setup(real_t p_step) {
|
|||
Vector3 jointAxis1 = A->get_transform().basis.xform(jointAxis1local);
|
||||
Vector3 hingeAxisWorld = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(2));
|
||||
|
||||
memnew_placement(&m_jacAng[0], GodotJacobianEntry3D(jointAxis0,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
memnew_placement(
|
||||
&m_jacAng[0],
|
||||
GodotJacobianEntry3D(
|
||||
jointAxis0,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
|
||||
memnew_placement(&m_jacAng[1], GodotJacobianEntry3D(jointAxis1,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
memnew_placement(
|
||||
&m_jacAng[1],
|
||||
GodotJacobianEntry3D(
|
||||
jointAxis1,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
|
||||
memnew_placement(&m_jacAng[2], GodotJacobianEntry3D(hingeAxisWorld,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
memnew_placement(
|
||||
&m_jacAng[2],
|
||||
GodotJacobianEntry3D(
|
||||
hingeAxisWorld,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
|
||||
// Compute limit information
|
||||
real_t hingeAngle = get_hinge_angle();
|
||||
|
|
@ -220,8 +231,7 @@ bool GodotHingeJoint3D::setup(real_t p_step) {
|
|||
|
||||
//Compute K = J*W*J' for hinge axis
|
||||
Vector3 axisA = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(2));
|
||||
m_kHinge = 1.0f / (A->compute_angular_impulse_denominator(axisA) +
|
||||
B->compute_angular_impulse_denominator(axisA));
|
||||
m_kHinge = 1.0f / (A->compute_angular_impulse_denominator(axisA) + B->compute_angular_impulse_denominator(axisA));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -284,7 +294,7 @@ void GodotHingeJoint3D::solve(real_t p_step) {
|
|||
if (len > real_t(0.00001)) {
|
||||
Vector3 normal = velrelOrthog.normalized();
|
||||
real_t denom = A->compute_angular_impulse_denominator(normal) +
|
||||
B->compute_angular_impulse_denominator(normal);
|
||||
B->compute_angular_impulse_denominator(normal);
|
||||
// scale for mass and relaxation
|
||||
velrelOrthog *= (real_t(1.) / denom) * m_relaxationFactor;
|
||||
}
|
||||
|
|
@ -295,7 +305,7 @@ void GodotHingeJoint3D::solve(real_t p_step) {
|
|||
if (len2 > real_t(0.00001)) {
|
||||
Vector3 normal2 = angularError.normalized();
|
||||
real_t denom2 = A->compute_angular_impulse_denominator(normal2) +
|
||||
B->compute_angular_impulse_denominator(normal2);
|
||||
B->compute_angular_impulse_denominator(normal2);
|
||||
angularError *= (real_t(1.) / denom2) * relaxation;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,16 +63,18 @@ bool GodotPinJoint3D::setup(real_t p_step) {
|
|||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
normal[i] = 1;
|
||||
memnew_placement(&m_jac[i], GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_transform().xform(m_pivotInA) - A->get_transform().origin - A->get_center_of_mass(),
|
||||
B->get_transform().xform(m_pivotInB) - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normal,
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
memnew_placement(
|
||||
&m_jac[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_transform().xform(m_pivotInA) - A->get_transform().origin - A->get_center_of_mass(),
|
||||
B->get_transform().xform(m_pivotInB) - B->get_transform().origin - B->get_center_of_mass(),
|
||||
normal,
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
normal[i] = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,16 +112,18 @@ bool GodotSliderJoint3D::setup(real_t p_step) {
|
|||
//linear part
|
||||
for (i = 0; i < 3; i++) {
|
||||
normalWorld = m_calculatedTransformA.basis.get_axis(i);
|
||||
memnew_placement(&m_jacLin[i], GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
m_relPosA - A->get_center_of_mass(),
|
||||
m_relPosB - B->get_center_of_mass(),
|
||||
normalWorld,
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
memnew_placement(
|
||||
&m_jacLin[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
m_relPosA - A->get_center_of_mass(),
|
||||
m_relPosB - B->get_center_of_mass(),
|
||||
normalWorld,
|
||||
A->get_inv_inertia(),
|
||||
A->get_inv_mass(),
|
||||
B->get_inv_inertia(),
|
||||
B->get_inv_mass()));
|
||||
m_jacLinDiagABInv[i] = real_t(1.) / m_jacLin[i].getDiagonal();
|
||||
m_depth[i] = m_delta.dot(normalWorld);
|
||||
}
|
||||
|
|
@ -129,12 +131,14 @@ bool GodotSliderJoint3D::setup(real_t p_step) {
|
|||
// angular part
|
||||
for (i = 0; i < 3; i++) {
|
||||
normalWorld = m_calculatedTransformA.basis.get_axis(i);
|
||||
memnew_placement(&m_jacAng[i], GodotJacobianEntry3D(
|
||||
normalWorld,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
memnew_placement(
|
||||
&m_jacAng[i],
|
||||
GodotJacobianEntry3D(
|
||||
normalWorld,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
}
|
||||
testAngLimits();
|
||||
Vector3 axisA = m_calculatedTransformA.basis.get_axis(0);
|
||||
|
|
|
|||
|
|
@ -137,8 +137,7 @@ void RendererCanvasCull::_attach_canvas_item_for_draw(RendererCanvasCull::Item *
|
|||
|
||||
// We have two choices now, if user has drawn something, we must assume users wants to draw the "mask", so compute the size based on this.
|
||||
// If nothing has been drawn, we just take it over and draw it ourselves.
|
||||
if (ci->canvas_group->fit_empty && (ci->commands == nullptr ||
|
||||
(ci->commands->next == nullptr && ci->commands->type == RendererCanvasCull::Item::Command::TYPE_RECT && (static_cast<RendererCanvasCull::Item::CommandRect *>(ci->commands)->flags & RendererCanvasRender::CANVAS_RECT_IS_GROUP)))) {
|
||||
if (ci->canvas_group->fit_empty && (ci->commands == nullptr || (ci->commands->next == nullptr && ci->commands->type == RendererCanvasCull::Item::Command::TYPE_RECT && (static_cast<RendererCanvasCull::Item::CommandRect *>(ci->commands)->flags & RendererCanvasRender::CANVAS_RECT_IS_GROUP)))) {
|
||||
// No commands, or sole command is the one used to draw, so we (re)create the draw command.
|
||||
ci->clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -567,11 +567,11 @@ void main() {
|
|||
depth = particle_size - s;
|
||||
const float EPSILON = 0.001;
|
||||
normal = mat3(FRAME.colliders[i].transform) *
|
||||
normalize(
|
||||
vec3(
|
||||
texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos + vec3(EPSILON, 0.0, 0.0)).r - texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos - vec3(EPSILON, 0.0, 0.0)).r,
|
||||
texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos + vec3(0.0, EPSILON, 0.0)).r - texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos - vec3(0.0, EPSILON, 0.0)).r,
|
||||
texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos + vec3(0.0, 0.0, EPSILON)).r - texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos - vec3(0.0, 0.0, EPSILON)).r));
|
||||
normalize(
|
||||
vec3(
|
||||
texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos + vec3(EPSILON, 0.0, 0.0)).r - texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos - vec3(EPSILON, 0.0, 0.0)).r,
|
||||
texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos + vec3(0.0, EPSILON, 0.0)).r - texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos - vec3(0.0, EPSILON, 0.0)).r,
|
||||
texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos + vec3(0.0, 0.0, EPSILON)).r - texture(sampler3D(sdf_vec_textures[FRAME.colliders[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos - vec3(0.0, 0.0, EPSILON)).r));
|
||||
}
|
||||
|
||||
} break;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
float hash_2d(vec2 p) {
|
||||
return fract(1.0e4 * sin(17.0 * p.x + 0.1 * p.y) *
|
||||
(0.1 + abs(sin(13.0 * p.y + p.x))));
|
||||
(0.1 + abs(sin(13.0 * p.y + p.x))));
|
||||
}
|
||||
|
||||
float hash_3d(vec3 p) {
|
||||
|
|
@ -29,8 +29,7 @@ float compute_alpha_hash_threshold(vec3 pos, float hash_scale) {
|
|||
|
||||
vec3 cases = vec3(a_interp * a_interp / (2.0 * min_lerp * (1.0 - min_lerp)),
|
||||
(a_interp - 0.5 * min_lerp) / (1.0 - min_lerp),
|
||||
1.0 - ((1.0 - a_interp) * (1.0 - a_interp) /
|
||||
(2.0 * min_lerp * (1.0 - min_lerp))));
|
||||
1.0 - ((1.0 - a_interp) * (1.0 - a_interp) / (2.0 * min_lerp * (1.0 - min_lerp))));
|
||||
|
||||
float alpha_hash_threshold =
|
||||
(lerp_factor < (1.0 - min_lerp)) ? ((lerp_factor < min_lerp) ? cases.x : cases.y) : cases.z;
|
||||
|
|
|
|||
|
|
@ -964,15 +964,15 @@ void main() {
|
|||
const float c4 = 0.886227;
|
||||
const float c5 = 0.247708;
|
||||
ambient_light += (c1 * lightmap_captures.data[index].sh[8].rgb * (wnormal.x * wnormal.x - wnormal.y * wnormal.y) +
|
||||
c3 * lightmap_captures.data[index].sh[6].rgb * wnormal.z * wnormal.z +
|
||||
c4 * lightmap_captures.data[index].sh[0].rgb -
|
||||
c5 * lightmap_captures.data[index].sh[6].rgb +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[4].rgb * wnormal.x * wnormal.y +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[7].rgb * wnormal.x * wnormal.z +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[5].rgb * wnormal.y * wnormal.z +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[3].rgb * wnormal.x +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[1].rgb * wnormal.y +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[2].rgb * wnormal.z);
|
||||
c3 * lightmap_captures.data[index].sh[6].rgb * wnormal.z * wnormal.z +
|
||||
c4 * lightmap_captures.data[index].sh[0].rgb -
|
||||
c5 * lightmap_captures.data[index].sh[6].rgb +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[4].rgb * wnormal.x * wnormal.y +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[7].rgb * wnormal.x * wnormal.z +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[5].rgb * wnormal.y * wnormal.z +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[3].rgb * wnormal.x +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[1].rgb * wnormal.y +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[2].rgb * wnormal.z);
|
||||
|
||||
} else if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP)) { // has actual lightmap
|
||||
bool uses_sh = bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_SH_LIGHTMAP);
|
||||
|
|
|
|||
|
|
@ -182,11 +182,11 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, float atte
|
|||
float d = scale * abs(transmittance_z);
|
||||
float dd = -d * d;
|
||||
vec3 profile = vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) +
|
||||
vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) +
|
||||
vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) +
|
||||
vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) +
|
||||
vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) +
|
||||
vec3(0.078, 0.0, 0.0) * exp(dd / 7.41);
|
||||
vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) +
|
||||
vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) +
|
||||
vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) +
|
||||
vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) +
|
||||
vec3(0.078, 0.0, 0.0) * exp(dd / 7.41);
|
||||
|
||||
diffuse_light += profile * transmittance_color.a * light_color * clamp(transmittance_boost - NdotL, 0.0, 1.0) * (1.0 / M_PI);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -930,15 +930,15 @@ void main() {
|
|||
const float c4 = 0.886227;
|
||||
const float c5 = 0.247708;
|
||||
ambient_light += (c1 * lightmap_captures.data[index].sh[8].rgb * (wnormal.x * wnormal.x - wnormal.y * wnormal.y) +
|
||||
c3 * lightmap_captures.data[index].sh[6].rgb * wnormal.z * wnormal.z +
|
||||
c4 * lightmap_captures.data[index].sh[0].rgb -
|
||||
c5 * lightmap_captures.data[index].sh[6].rgb +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[4].rgb * wnormal.x * wnormal.y +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[7].rgb * wnormal.x * wnormal.z +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[5].rgb * wnormal.y * wnormal.z +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[3].rgb * wnormal.x +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[1].rgb * wnormal.y +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[2].rgb * wnormal.z);
|
||||
c3 * lightmap_captures.data[index].sh[6].rgb * wnormal.z * wnormal.z +
|
||||
c4 * lightmap_captures.data[index].sh[0].rgb -
|
||||
c5 * lightmap_captures.data[index].sh[6].rgb +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[4].rgb * wnormal.x * wnormal.y +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[7].rgb * wnormal.x * wnormal.z +
|
||||
2.0 * c1 * lightmap_captures.data[index].sh[5].rgb * wnormal.y * wnormal.z +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[3].rgb * wnormal.x +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[1].rgb * wnormal.y +
|
||||
2.0 * c2 * lightmap_captures.data[index].sh[2].rgb * wnormal.z);
|
||||
|
||||
} else if (bool(draw_call.flags & INSTANCE_FLAGS_USE_LIGHTMAP)) { // has actual lightmap
|
||||
bool uses_sh = bool(draw_call.flags & INSTANCE_FLAGS_USE_SH_LIGHTMAP);
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
|
|||
vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
|
||||
|
||||
return (g0(fuv.y) * (g0x * textureLod(tex, p0, lod) + g1x * textureLod(tex, p1, lod))) +
|
||||
(g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + g1x * textureLod(tex, p3, lod)));
|
||||
(g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + g1x * textureLod(tex, p3, lod)));
|
||||
}
|
||||
|
||||
#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)
|
||||
|
|
@ -341,14 +341,14 @@ vec3 do_fxaa(vec3 color, float exposure, vec2 uv_interp) {
|
|||
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
||||
|
||||
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
||||
(0.25 * FXAA_REDUCE_MUL),
|
||||
(0.25 * FXAA_REDUCE_MUL),
|
||||
FXAA_REDUCE_MIN);
|
||||
|
||||
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
||||
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
||||
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
||||
dir * rcpDirMin)) *
|
||||
params.pixel_size;
|
||||
params.pixel_size;
|
||||
|
||||
#ifdef MULTIVIEW
|
||||
vec3 rgbA = 0.5 * exposure * (textureLod(source_color, vec3(uv_interp + dir * (1.0 / 3.0 - 0.5), ViewIndex), 0.0).xyz + textureLod(source_color, vec3(uv_interp + dir * (2.0 / 3.0 - 0.5), ViewIndex), 0.0).xyz) * params.luminance_multiplier;
|
||||
|
|
|
|||
|
|
@ -3296,16 +3296,16 @@ bool ShaderLanguage::is_float_type(DataType p_type) {
|
|||
}
|
||||
bool ShaderLanguage::is_sampler_type(DataType p_type) {
|
||||
return p_type == TYPE_SAMPLER2D ||
|
||||
p_type == TYPE_ISAMPLER2D ||
|
||||
p_type == TYPE_USAMPLER2D ||
|
||||
p_type == TYPE_SAMPLER2DARRAY ||
|
||||
p_type == TYPE_ISAMPLER2DARRAY ||
|
||||
p_type == TYPE_USAMPLER2DARRAY ||
|
||||
p_type == TYPE_SAMPLER3D ||
|
||||
p_type == TYPE_ISAMPLER3D ||
|
||||
p_type == TYPE_USAMPLER3D ||
|
||||
p_type == TYPE_SAMPLERCUBE ||
|
||||
p_type == TYPE_SAMPLERCUBEARRAY;
|
||||
p_type == TYPE_ISAMPLER2D ||
|
||||
p_type == TYPE_USAMPLER2D ||
|
||||
p_type == TYPE_SAMPLER2DARRAY ||
|
||||
p_type == TYPE_ISAMPLER2DARRAY ||
|
||||
p_type == TYPE_USAMPLER2DARRAY ||
|
||||
p_type == TYPE_SAMPLER3D ||
|
||||
p_type == TYPE_ISAMPLER3D ||
|
||||
p_type == TYPE_USAMPLER3D ||
|
||||
p_type == TYPE_SAMPLERCUBE ||
|
||||
p_type == TYPE_SAMPLERCUBEARRAY;
|
||||
}
|
||||
|
||||
Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type, int p_array_size, ShaderLanguage::ShaderNode::Uniform::Hint p_hint) {
|
||||
|
|
@ -3873,16 +3873,16 @@ void ShaderLanguage::get_keyword_list(List<String> *r_keywords) {
|
|||
|
||||
bool ShaderLanguage::is_control_flow_keyword(String p_keyword) {
|
||||
return p_keyword == "break" ||
|
||||
p_keyword == "case" ||
|
||||
p_keyword == "continue" ||
|
||||
p_keyword == "default" ||
|
||||
p_keyword == "do" ||
|
||||
p_keyword == "else" ||
|
||||
p_keyword == "for" ||
|
||||
p_keyword == "if" ||
|
||||
p_keyword == "return" ||
|
||||
p_keyword == "switch" ||
|
||||
p_keyword == "while";
|
||||
p_keyword == "case" ||
|
||||
p_keyword == "continue" ||
|
||||
p_keyword == "default" ||
|
||||
p_keyword == "do" ||
|
||||
p_keyword == "else" ||
|
||||
p_keyword == "for" ||
|
||||
p_keyword == "if" ||
|
||||
p_keyword == "return" ||
|
||||
p_keyword == "switch" ||
|
||||
p_keyword == "while";
|
||||
}
|
||||
|
||||
void ShaderLanguage::get_builtin_funcs(List<String> *r_keywords) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue