Updating Ghoul repository

Updating SGCT repository
Removing compiler warnings
This commit is contained in:
Alexander Bock
2017-03-10 09:32:16 -05:00
parent dbceb169f7
commit bcf92804b6
39 changed files with 201 additions and 164 deletions
@@ -170,8 +170,6 @@ bool RenderableModel::deinitialize() {
void RenderableModel::render(const RenderData& data) {
_programObject->activate();
double lt;
// Fading
if (_performFade && _fading > 0.f) {
_fading = _fading - 0.01f;
@@ -243,7 +241,6 @@ void RenderableModel::update(const UpdateData& data) {
// _time = futureTime;
//}
double lt;
_sunPos = OsEng.renderEngine().scene()->sceneGraphNode("Sun")->worldPosition();
}
+3 -3
View File
@@ -203,9 +203,9 @@ void RenderablePlane::render(const RenderData& data) {
if (textureNode != nullptr){
RenderablePlanetProjection* t = static_cast<RenderablePlanetProjection*>(textureNode->renderable());
_texture = std::unique_ptr<ghoul::opengl::Texture>(&(t->baseTexture()));
float h = _texture->height();
float w = _texture->width();
float scale = h / w;
unsigned int h = _texture->height();
unsigned int w = _texture->width();
float scale = static_cast<float>(h) / static_cast<float>(w);
scaleTransform = glm::scale(glm::mat4(1.0), glm::vec3(1.f, scale, 1.f));
}
}
@@ -82,10 +82,10 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
//int nr2 = 0;
for (int i = 0; i <= _segments; i++) {
for (int nSegment = 0; nSegment <= _segments; ++nSegment) {
// define an extra vertex around the y-axis due to texture mapping
for (int j = 0; j <= _segments; j++) {
const float fi = static_cast<float>(i);
const float fi = static_cast<float>(nSegment);
const float fj = static_cast<float>(j);
// inclination angle (north to south)
+7 -7
View File
@@ -155,17 +155,17 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
addProperty(_useLineFade);
if (dictionary.hasKeyAndValue<double>(KeyFade)) {
_lineFade = dictionary.value<double>(KeyFade);
_lineFade = static_cast<float>(dictionary.value<double>(KeyFade));
}
addProperty(_lineFade);
if (dictionary.hasKeyAndValue<double>(KeyLineWidth)) {
_lineWidth = dictionary.value<double>(KeyLineWidth);
_lineWidth = static_cast<float>(dictionary.value<double>(KeyLineWidth));
}
addProperty(_lineWidth);
if (dictionary.hasKeyAndValue<double>(KeyPointSize)) {
_pointSize = dictionary.value<double>(KeyPointSize);
_pointSize = static_cast<int>(dictionary.value<double>(KeyPointSize));
}
addProperty(_pointSize);
@@ -247,12 +247,12 @@ void RenderableTrail::render(const RenderData & data) {
}
bool renderLines =
_renderingModes == RenderingModeLines |
_renderingModes == RenderingModeLinesPoints;
(_renderingModes == RenderingModeLines) |
(_renderingModes == RenderingModeLinesPoints);
bool renderPoints =
_renderingModes == RenderingModePoints |
_renderingModes == RenderingModeLinesPoints;
(_renderingModes == RenderingModePoints) |
(_renderingModes == RenderingModeLinesPoints);
if (renderLines) {
glLineWidth(_lineWidth);
@@ -132,7 +132,7 @@ documentation::Documentation RenderableTrailOrbit::Documentation() {
RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
: RenderableTrail(dictionary)
, _period("period", "Period in days", 0.0, 0.0, 1e9)
, _resolution("resolution", "Number of Samples along Orbit", 10000, 1, 1e6)
, _resolution("resolution", "Number of Samples along Orbit", 10000, 1, 1000000)
, _needsFullSweep(true)
, _indexBufferDirty(true)
{
@@ -148,7 +148,7 @@ RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
// Period is in days
using namespace std::chrono;
int factor = duration_cast<seconds>(hours(24)).count();
long long factor = duration_cast<seconds>(hours(24)).count();
_period = dictionary.value<double>(KeyPeriod) * factor;
_period.onChange([&] { _needsFullSweep = true; _indexBufferDirty = true; });
addProperty(_period);
@@ -349,7 +349,7 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
}
// See how many points we need to drop
int nNewPoints = floor(delta / secondsPerPoint);
int nNewPoints = static_cast<int>(floor(delta / secondsPerPoint));
// If we would need to generate more new points than there are total points in the
// array, it is faster to regenerate the entire array
@@ -384,7 +384,7 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
else {
// See how many new points needs to be generated. Delta is negative, so we need
// to invert the ratio
int nNewPoints = -(floor(delta / secondsPerPoint));
int nNewPoints = -(static_cast<int>(floor(delta / secondsPerPoint)));
// If we would need to generate more new points than there are total points in the
// array, it is faster to regenerate the entire array
@@ -130,7 +130,7 @@ RenderableTrailTrajectory::RenderableTrailTrajectory(const ghoul::Dictionary& di
, _timeStampSubsamplingFactor(
"subSample",
"Time Stamp Subsampling Factor",
1, 1, 1e9
1, 1, 1000000000
)
, _renderFullTrail("renderFullTrail", "Render Full Trail", false)
, _needsFullSweep(true)
@@ -159,7 +159,9 @@ RenderableTrailTrajectory::RenderableTrailTrajectory(const ghoul::Dictionary& di
addProperty(_sampleInterval);
if (dictionary.hasKeyAndValue<double>(KeyTimeStampSubsample)) {
_timeStampSubsamplingFactor = dictionary.value<double>(KeyTimeStampSubsample);
_timeStampSubsamplingFactor = static_cast<int>(
dictionary.value<double>(KeyTimeStampSubsample)
);
}
_timeStampSubsamplingFactor.onChange([this] { _subsamplingIsDirty = true; });
addProperty(_timeStampSubsamplingFactor);
@@ -208,7 +210,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) {
double totalSampleInterval = _sampleInterval / _timeStampSubsamplingFactor;
// How many values do we need to compute given the distance between the start and
// end date and the desired sample interval
int nValues = (_end - _start) / totalSampleInterval;
int nValues = static_cast<int>((_end - _start) / totalSampleInterval);
// Make space for the vertices
_vertexArray.clear();
@@ -246,16 +248,16 @@ void RenderableTrailTrajectory::update(const UpdateData& data) {
// If the full trail should be rendered at all times, we can directly render the
// entire set
_primaryRenderInformation.first = 0;
_primaryRenderInformation.count = _vertexArray.size();
_primaryRenderInformation.count = static_cast<GLsizei>(_vertexArray.size());
}
else {
// If only trail so far should be rendered, we need to find the corresponding time
// in the array and only render it until then
_primaryRenderInformation.first = 0;
double t = (data.time - _start) / (_end - _start);
_primaryRenderInformation.count = std::min<GLsizei>(
ceil(_vertexArray.size() * t),
_vertexArray.size() - 1
_primaryRenderInformation.count = std::min(
static_cast<GLsizei>(ceil(_vertexArray.size() * t)),
static_cast<GLsizei>(_vertexArray.size() - 1)
);
}
@@ -82,15 +82,20 @@ bool ScreenSpaceFramebuffer::deinitialize(){
return true;
}
void ScreenSpaceFramebuffer::render(){
void ScreenSpaceFramebuffer::render() {
glm::vec2 resolution = OsEng.windowWrapper().currentWindowResolution();
glm::vec4 size = _size.value();
float xratio = _originalViewportSize.x / (size.z-size.x);
float yratio = _originalViewportSize.y / (size.w-size.y);;
if(!_renderFunctions.empty()){
glViewport (-size.x*xratio, -size.y*yratio, _originalViewportSize.x*xratio, _originalViewportSize.y*yratio);
if (!_renderFunctions.empty()) {
glViewport(
static_cast<GLint>(-size.x * xratio),
static_cast<GLint>(-size.y * yratio),
static_cast<GLsizei>(_originalViewportSize.x * xratio),
static_cast<GLsizei>(_originalViewportSize.y * yratio)
);
GLint defaultFBO = _framebuffer->getActiveObject();
_framebuffer->activate();
@@ -103,7 +108,12 @@ void ScreenSpaceFramebuffer::render(){
_framebuffer->deactivate();
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
glViewport (0, 0, resolution.x, resolution.y);
glViewport(
0,
0,
static_cast<GLsizei>(resolution.x),
static_cast<GLsizei>(resolution.y)
);
glm::mat4 rotation = rotationMatrix();
glm::mat4 translation = translationMatrix();
+5 -2
View File
@@ -157,15 +157,18 @@ void ScreenSpaceImage::updateTexture() {
if (_futureImage.valid() && DownloadManager::futureReady(_futureImage)) {
DownloadManager::MemoryFile imageFile = _futureImage.get();
if (imageFile.corrupted)
if (imageFile.corrupted) {
return nullptr;
}
return (ghoul::io::TextureReader::ref().loadTexture(
reinterpret_cast<void*>(imageFile.buffer),
imageFile.size,
imageFile.format)
);
}
else {
return nullptr;
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ StaticScale::StaticScale(const ghoul::Dictionary& dictionary)
{
documentation::testSpecificationAndThrow(Documentation(), dictionary, "StaticScale");
_scaleValue = dictionary.value<double>(KeyValue);
_scaleValue = static_cast<float>(dictionary.value<double>(KeyValue));
}
double StaticScale::scaleValue() const {