diff --git a/src/celengine/galaxy.cpp b/src/celengine/galaxy.cpp index a0103b891..ee2151825 100644 --- a/src/celengine/galaxy.cpp +++ b/src/celengine/galaxy.cpp @@ -112,20 +112,20 @@ constexpr const GalaxyTypeName GalaxyTypeNames[] = { "E7", GalaxyType::E7 }, }; -void galaxyTextureEval(float u, float v, float /*w*/, unsigned char *pixel) +void galaxyTextureEval(float u, float v, float /*w*/, std::uint8_t *pixel) { float r = 0.9f - std::sqrt(u * u + v * v ); if (r < 0) r = 0; - auto pixVal = static_cast(r * 255.99f); + auto pixVal = static_cast(r * 255.99f); pixel[0] = 255;//65; pixel[1] = 255;//64; pixel[2] = 255;//65; pixel[3] = pixVal; } -void colorTextureEval(float u, float /*v*/, float /*w*/, unsigned char *pixel) +void colorTextureEval(float u, float /*v*/, float /*w*/, std::uint8_t *pixel) { unsigned int i = static_cast((static_cast(u)*0.5f + 0.5f)*255.99f); // [-1, 1] -> [0, 255] @@ -136,9 +136,9 @@ void colorTextureEval(float u, float /*v*/, float /*w*/, unsigned char *pixel) //convert Hue to RGB float r, g, b; DeepSkyObject::hsv2rgb(&r, &g, &b, hue, 0.20f, 1.0f); - pixel[0] = static_cast(r * 255.99f); - pixel[1] = static_cast(g * 255.99f); - pixel[2] = static_cast(b * 255.99f); + pixel[0] = static_cast(r * 255.99f); + pixel[1] = static_cast(g * 255.99f); + pixel[2] = static_cast(b * 255.99f); } struct GalaxyVertex diff --git a/src/celengine/globular.cpp b/src/celengine/globular.cpp index 9dc6ec735..943b365ab 100644 --- a/src/celengine/globular.cpp +++ b/src/celengine/globular.cpp @@ -80,7 +80,7 @@ constexpr const float RADIUS_CORRECTION = 0.025f; float CBin, RRatio, XI, Rr = 1.0f, Gg = 1.0f, Bb = 1.0f; -void globularTextureEval(float u, float v, float /*w*/, unsigned char *pixel) +void globularTextureEval(float u, float v, float /*w*/, std::uint8_t *pixel) { // use an exponential luminosity shape for the individual stars // giving sort of a halo for the brighter (i.e.bigger) stars. @@ -91,7 +91,7 @@ void globularTextureEval(float u, float v, float /*w*/, unsigned char *pixel) if (lumi <= 0.0f) lumi = 0.0f; - auto pixVal = static_cast(lumi * 255.99f); + auto pixVal = static_cast(lumi * 255.99f); pixel[0] = 255; pixel[1] = 255; pixel[2] = 255; @@ -123,7 +123,7 @@ float relStarDensity(float eta) return ((std::log(rho2) + 4.0f * (1.0f - std::sqrt(rho2)) * Xi) / (rho2 - 1.0f) + XI2) / (1.0f - 2.0f * Xi + XI2); } -void centerCloudTexEval(float u, float v, float /*w*/, unsigned char *pixel) +void centerCloudTexEval(float u, float v, float /*w*/, std::uint8_t *pixel) { /*! For reasons of speed, calculate central "cloud" texture only for * 8 bins of King_1962 concentration, c = CBin, XI(CBin), RRatio(CBin). @@ -154,7 +154,7 @@ void centerCloudTexEval(float u, float v, float /*w*/, unsigned char *pixel) pixel[0] = 255; pixel[1] = 255; pixel[2] = 255; - pixel[3] = static_cast(relStarDensity(eta) * profile_2d * 255.99f); + pixel[3] = static_cast(relStarDensity(eta) * profile_2d * 255.99f); } void initGlobularData(celgl::VertexObject& vo, diff --git a/src/celengine/texture.h b/src/celengine/texture.h index 0b246333b..fb1d76c22 100644 --- a/src/celengine/texture.h +++ b/src/celengine/texture.h @@ -10,13 +10,14 @@ #ifndef _CELENGINE_TEXTURE_H_ #define _CELENGINE_TEXTURE_H_ +#include #include #include #include #include -typedef void (*ProceduralTexEval)(float, float, float, unsigned char*); +typedef void (*ProceduralTexEval)(float, float, float, std::uint8_t*); struct TextureTile @@ -40,7 +41,7 @@ class TexelFunctionObject TexelFunctionObject() {}; virtual ~TexelFunctionObject() {}; virtual void operator()(float u, float v, float w, - unsigned char* pixel) = 0; + std::uint8_t* pixel) = 0; };