Removed redundant float casts
fix cast promotions
This commit is contained in:
@@ -110,11 +110,11 @@ Py::Tuple MaterialPy::getAmbientColor() const
|
||||
void MaterialPy::setAmbientColor(Py::Tuple arg)
|
||||
{
|
||||
Color c;
|
||||
c.r = (float)Py::Float(arg.getItem(0));
|
||||
c.g = (float)Py::Float(arg.getItem(1));
|
||||
c.b = (float)Py::Float(arg.getItem(2));
|
||||
c.r = Py::Float(arg.getItem(0));
|
||||
c.g = Py::Float(arg.getItem(1));
|
||||
c.b = Py::Float(arg.getItem(2));
|
||||
if (arg.size() == 4)
|
||||
c.a = (float)Py::Float(arg.getItem(3));
|
||||
c.a = Py::Float(arg.getItem(3));
|
||||
getMaterialPtr()->ambientColor = c;
|
||||
}
|
||||
|
||||
@@ -131,11 +131,11 @@ Py::Tuple MaterialPy::getDiffuseColor() const
|
||||
void MaterialPy::setDiffuseColor(Py::Tuple arg)
|
||||
{
|
||||
Color c;
|
||||
c.r = (float)Py::Float(arg.getItem(0));
|
||||
c.g = (float)Py::Float(arg.getItem(1));
|
||||
c.b = (float)Py::Float(arg.getItem(2));
|
||||
c.r = Py::Float(arg.getItem(0));
|
||||
c.g = Py::Float(arg.getItem(1));
|
||||
c.b = Py::Float(arg.getItem(2));
|
||||
if (arg.size() == 4)
|
||||
c.a = (float)Py::Float(arg.getItem(3));
|
||||
c.a = Py::Float(arg.getItem(3));
|
||||
getMaterialPtr()->diffuseColor = c;
|
||||
}
|
||||
|
||||
@@ -152,11 +152,11 @@ Py::Tuple MaterialPy::getEmissiveColor() const
|
||||
void MaterialPy::setEmissiveColor(Py::Tuple arg)
|
||||
{
|
||||
Color c;
|
||||
c.r = (float)Py::Float(arg.getItem(0));
|
||||
c.g = (float)Py::Float(arg.getItem(1));
|
||||
c.b = (float)Py::Float(arg.getItem(2));
|
||||
c.r = Py::Float(arg.getItem(0));
|
||||
c.g = Py::Float(arg.getItem(1));
|
||||
c.b = Py::Float(arg.getItem(2));
|
||||
if (arg.size() == 4)
|
||||
c.a = (float)Py::Float(arg.getItem(3));
|
||||
c.a = Py::Float(arg.getItem(3));
|
||||
getMaterialPtr()->emissiveColor = c;
|
||||
}
|
||||
|
||||
@@ -173,11 +173,11 @@ Py::Tuple MaterialPy::getSpecularColor() const
|
||||
void MaterialPy::setSpecularColor(Py::Tuple arg)
|
||||
{
|
||||
Color c;
|
||||
c.r = (float)Py::Float(arg.getItem(0));
|
||||
c.g = (float)Py::Float(arg.getItem(1));
|
||||
c.b = (float)Py::Float(arg.getItem(2));
|
||||
c.r = Py::Float(arg.getItem(0));
|
||||
c.g = Py::Float(arg.getItem(1));
|
||||
c.b = Py::Float(arg.getItem(2));
|
||||
if (arg.size() == 4)
|
||||
c.a = (float)Py::Float(arg.getItem(3));
|
||||
c.a = Py::Float(arg.getItem(3));
|
||||
getMaterialPtr()->specularColor = c;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ Py::Float MaterialPy::getShininess() const
|
||||
|
||||
void MaterialPy::setShininess(Py::Float arg)
|
||||
{
|
||||
getMaterialPtr()->shininess = (float)arg;
|
||||
getMaterialPtr()->shininess = arg;
|
||||
}
|
||||
|
||||
Py::Float MaterialPy::getTransparency() const
|
||||
@@ -198,7 +198,7 @@ Py::Float MaterialPy::getTransparency() const
|
||||
|
||||
void MaterialPy::setTransparency(Py::Float arg)
|
||||
{
|
||||
getMaterialPtr()->transparency = (float)arg;
|
||||
getMaterialPtr()->transparency = arg;
|
||||
}
|
||||
|
||||
PyObject *MaterialPy::getCustomAttributes(const char* /*attr*/) const
|
||||
|
||||
@@ -105,13 +105,13 @@ SbRotation Camera::bottom()
|
||||
|
||||
SbRotation Camera::front()
|
||||
{
|
||||
auto root = (float)(sqrt(2.0)/2.0);
|
||||
auto root = sqrtf(2.0)/2.0f;
|
||||
return {root, 0, 0, root};
|
||||
}
|
||||
|
||||
SbRotation Camera::rear()
|
||||
{
|
||||
auto root = (float)(sqrt(2.0)/2.0);
|
||||
auto root = sqrtf(2.0)/2.0f;
|
||||
return {0, root, root, 0};
|
||||
}
|
||||
|
||||
@@ -127,25 +127,6 @@ SbRotation Camera::left()
|
||||
|
||||
SbRotation Camera::isometric()
|
||||
{
|
||||
//from math import sqrt, degrees, asin
|
||||
//p1=App.Rotation(App.Vector(1,0,0),45)
|
||||
//p2=App.Rotation(App.Vector(0,0,1),-45)
|
||||
//p3=p2.multiply(p1)
|
||||
//return SbRotation(0.353553f, -0.146447f, -0.353553f, 0.853553f);
|
||||
|
||||
//from math import sqrt, degrees, asin
|
||||
//p1=App.Rotation(App.Vector(1,0,0),90)
|
||||
//p2=App.Rotation(App.Vector(0,0,1),135)
|
||||
//p3=App.Rotation(App.Vector(-1,1,0),degrees(asin(-sqrt(1.0/3.0))))
|
||||
//p4=p3.multiply(p2).multiply(p1)
|
||||
//return SbRotation(0.17592, 0.424708, 0.820473, 0.339851);
|
||||
|
||||
//from math import sqrt, degrees, asin
|
||||
//p1=App.Rotation(App.Vector(1,0,0),90)
|
||||
//p2=App.Rotation(App.Vector(0,0,1),45)
|
||||
//#p3=App.Rotation(App.Vector(1,1,0),45)
|
||||
//p3=App.Rotation(App.Vector(1,1,0),degrees(asin(-sqrt(1.0/3.0))))
|
||||
//p4=p3.multiply(p2).multiply(p1)
|
||||
return {0.424708F, 0.17592F, 0.339851F, 0.820473F};
|
||||
}
|
||||
|
||||
|
||||
@@ -374,9 +374,9 @@ App::Color Preferences::lightenColor(App::Color orig)
|
||||
green += newm;
|
||||
blue += newm;
|
||||
|
||||
double redF = (float)red / 255.0;
|
||||
double greenF = (float)green / 255.0;
|
||||
double blueF = (float)blue / 255.0;
|
||||
double redF = (double)red / 255.0;
|
||||
double greenF = (double)green / 255.0;
|
||||
double blueF = (double)blue / 255.0;
|
||||
|
||||
return App::Color(redF, greenF, blueF, orig.a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user