mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Removes most of Visual Studio warnings
This commit is contained in:
@@ -516,7 +516,7 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
|
||||
bool buttons[2] = { button0 != 0, button1 != 0 };
|
||||
|
||||
double dt = std::max(sgct::Engine::instance()->getDt(), 1.0/60.0);
|
||||
_gui.startFrame(dt, glm::vec2(glm::ivec2(x,y)), glm::vec2(posX, posY), buttons);
|
||||
_gui.startFrame(static_cast<float>(dt), glm::vec2(glm::ivec2(x,y)), glm::vec2(posX, posY), buttons);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ int distance(lua_State* L) {
|
||||
|
||||
double d1 = luaL_checknumber(L, -2);
|
||||
double d2 = luaL_checknumber(L, -1);
|
||||
PowerScaledScalar dist(d1, d2);
|
||||
PowerScaledScalar dist(static_cast<float>(d1), static_cast<float>(d2));
|
||||
OsEng.interactionHandler().distanceDelta(dist);
|
||||
return 0;
|
||||
}
|
||||
@@ -515,7 +515,7 @@ void InteractionHandler::mousePositionCallback(int x, int y) {
|
||||
|
||||
void InteractionHandler::mouseScrollWheelCallback(int pos) {
|
||||
if (_mouseController)
|
||||
_mouseController->scrollWheel(float(pos));
|
||||
_mouseController->scrollWheel(pos);
|
||||
}
|
||||
|
||||
void InteractionHandler::orbitDelta(const glm::quat& rotation)
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace interaction {
|
||||
|
||||
void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier modifier) {
|
||||
// TODO package in script
|
||||
const double speed = 2.75;
|
||||
const double dt = _handler->deltaTime();
|
||||
const float speed = 2.75;
|
||||
const float dt = static_cast<float>( _handler->deltaTime());
|
||||
if(action == KeyAction::Press|| action == KeyAction::Repeat) {
|
||||
if (key == Key::S) {
|
||||
glm::vec3 euler(speed * dt, 0.0, 0.0);
|
||||
@@ -92,7 +92,7 @@ void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier
|
||||
_handler->distanceDelta(dist);
|
||||
}
|
||||
if (key == Key::T) {
|
||||
PowerScaledScalar dist(-speed * pow(10, 11) * dt, 0.0);
|
||||
PowerScaledScalar dist(-speed * pow(10.0f, 11.0f) * dt, 0.0f);
|
||||
_handler->distanceDelta(dist);
|
||||
}
|
||||
//if (key == Keys::G) {
|
||||
@@ -101,11 +101,11 @@ void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier
|
||||
// distanceDelta(dist);
|
||||
//}
|
||||
if (key == Key::Y) {
|
||||
PowerScaledScalar dist(-speed * 100.0 * dt, 6.0);
|
||||
PowerScaledScalar dist(-speed * 100.0f * dt, 6.0f);
|
||||
_handler->distanceDelta(dist);
|
||||
}
|
||||
if (key == Key::H) {
|
||||
PowerScaledScalar dist(speed * 100.0 * dt, 6.0);
|
||||
PowerScaledScalar dist(speed * 100.0f * dt, 6.0f);
|
||||
_handler->distanceDelta(dist);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ glm::vec3 MouseController::mapToTrackball(glm::vec2 mousePos) {
|
||||
if (out.x*out.x + out.y*out.y <= RADIUS*RADIUS / 2.0) {
|
||||
//Spherical Region
|
||||
out.z = RADIUS*RADIUS - (out.x*out.x + out.y*out.y);
|
||||
out.z = out.z > 0.0 ? sqrtf(out.z) : 0.0;
|
||||
out.z = out.z > 0.0f ? sqrtf(out.z) : 0.0f;
|
||||
}
|
||||
else { //Hyperbolic Region - for smooth z values
|
||||
out.z = (RADIUS*RADIUS) / (2.0*sqrt(out.x*out.x + out.y*out.y));
|
||||
out.z = (RADIUS*RADIUS) / (2.0f*sqrt(out.x*out.x + out.y*out.y));
|
||||
}
|
||||
|
||||
return glm::normalize(out);
|
||||
@@ -70,8 +70,8 @@ glm::vec3 MouseController::mapToCamera(glm::vec3 trackballPos) {
|
||||
|
||||
void MouseController::trackballRotate(int x, int y) {
|
||||
// Normalize mouse coordinates to [0,1]
|
||||
float width = sgct::Engine::instance()->getActiveXResolution();
|
||||
float height = sgct::Engine::instance()->getActiveYResolution();
|
||||
float width = static_cast<float>(sgct::Engine::instance()->getActiveXResolution());
|
||||
float height = static_cast<float>(sgct::Engine::instance()->getActiveYResolution());
|
||||
glm::vec2 mousePos = glm::vec2((float)x / width, (float)y / height);
|
||||
|
||||
mousePos = glm::clamp(mousePos, -0.5, 1.5); // Ugly fix #1: Camera position becomes NaN on mouse values outside [-0.5, 1.5]
|
||||
@@ -89,7 +89,7 @@ void MouseController::trackballRotate(int x, int y) {
|
||||
if (curTrackballPos != _lastTrackballPos) {
|
||||
// calculate rotation angle (in radians)
|
||||
float rotationAngle = glm::angle(curTrackballPos, _lastTrackballPos);
|
||||
rotationAngle *= _handler->deltaTime() * 100.0f;
|
||||
rotationAngle *= static_cast<float>(_handler->deltaTime()) * 100.0f;
|
||||
|
||||
// Map trackballpos to camera
|
||||
// glm::vec3 trackballMappedToCamera = mapToCamera(_lastTrackballPos - curTrackballPos);
|
||||
@@ -125,18 +125,18 @@ void TrackballMouseController::button(MouseAction action, MouseButton button) {
|
||||
|
||||
void TrackballMouseController::move(float x, float y) {
|
||||
if (_leftMouseButtonDown)
|
||||
trackballRotate(x, y);
|
||||
trackballRotate(static_cast<int>(x), static_cast<int>(y));
|
||||
}
|
||||
|
||||
void TrackballMouseController::scrollWheel(int pos) {
|
||||
const double speed = 4.75;
|
||||
const double dt = _handler->deltaTime();
|
||||
const float speed = 4.75f;
|
||||
const float dt = static_cast<float>(_handler->deltaTime());
|
||||
if (pos < 0) {
|
||||
PowerScaledScalar dist(speed * dt, 0.0);
|
||||
PowerScaledScalar dist(speed * dt, 0.0f);
|
||||
_handler->distanceDelta(dist);
|
||||
}
|
||||
else if (pos > 0) {
|
||||
PowerScaledScalar dist(-speed * dt, 0.0);
|
||||
PowerScaledScalar dist(-speed * dt, 0.0f);
|
||||
_handler->distanceDelta(dist);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ void RenderableModel::render(const RenderData& data)
|
||||
glm::mat4 tmp = glm::mat4(1);
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 3; j++){
|
||||
tmp[i][j] = _stateMatrix[i][j];
|
||||
tmp[i][j] = static_cast<float>(_stateMatrix[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ void RenderablePlanet::render(const RenderData& data)
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 3; j++){
|
||||
transform[i][j] = _stateMatrix[i][j];
|
||||
transform[i][j] = static_cast<float>(_stateMatrix[i][j]);
|
||||
}
|
||||
}
|
||||
transform = transform* rot;
|
||||
|
||||
@@ -114,8 +114,8 @@ bool RenderableFieldlines::initialize() {
|
||||
// Arrange data for glMultiDrawArrays
|
||||
for (int j = 0; j < fieldlinesData.size(); ++j) {
|
||||
_lineStart.push_back(prevEnd);
|
||||
_lineCount.push_back(fieldlinesData[j].size());
|
||||
prevEnd = prevEnd + fieldlinesData[j].size();
|
||||
_lineCount.push_back(static_cast<int>(fieldlinesData[j].size()));
|
||||
prevEnd = prevEnd + static_cast<int>(fieldlinesData[j].size());
|
||||
vertexData.insert( vertexData.end(), fieldlinesData[j].begin(), fieldlinesData[j].end());
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ void RenderableFieldlines::render(const RenderData& data) {
|
||||
|
||||
// ------ DRAW FIELDLINES -----------------
|
||||
glBindVertexArray(_fieldlineVAO);
|
||||
glMultiDrawArrays(GL_LINE_STRIP_ADJACENCY, &_lineStart[0], &_lineCount[0], _lineStart.size());
|
||||
glMultiDrawArrays(GL_LINE_STRIP_ADJACENCY, &_lineStart[0], &_lineCount[0], static_cast<GLsizei>(_lineStart.size()));
|
||||
glBindVertexArray(0);
|
||||
|
||||
_shader->deactivate();
|
||||
|
||||
@@ -85,7 +85,7 @@ void RenderableFov::fullYearSweep(){
|
||||
}
|
||||
|
||||
_stride = 8;
|
||||
_vsize = _varray.size();
|
||||
_vsize = static_cast<unsigned int>(_varray.size());
|
||||
_vtotal = static_cast<int>(_vsize / _stride);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void RenderableFov::render(const RenderData& data){
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 3; j++){
|
||||
tmp[i][j] = _stateMatrix[i][j];
|
||||
tmp[i][j] = static_cast<float>(_stateMatrix[i][j]);
|
||||
}
|
||||
}
|
||||
transform = tmp*rot;
|
||||
@@ -187,7 +187,7 @@ void RenderableFov::render(const RenderData& data){
|
||||
|
||||
bool found = openspace::SpiceManager::ref().getFieldOfView("NH_LORRI", shape, name, boresight, bounds);
|
||||
|
||||
float size = 4 * sizeof(float);
|
||||
size_t size = 4 * sizeof(float);
|
||||
float *begin = &_varray[0];
|
||||
|
||||
glm::vec4 origin(0);
|
||||
@@ -195,7 +195,7 @@ void RenderableFov::render(const RenderData& data){
|
||||
glm::vec4 col_end(1.00, 0.29, 0.00, 1);
|
||||
glm::vec4 bsight_t(boresight[0], boresight[1], boresight[2], data.position[3]-3);
|
||||
|
||||
float sc = 2.2;
|
||||
float sc = 2.2f;
|
||||
glm::vec4 corner1(bounds[0][0], bounds[0][1], bounds[0][2], data.position[3]-sc);
|
||||
memcpy(begin, glm::value_ptr(origin), size);
|
||||
memcpy(begin + 4, glm::value_ptr(col_start), size);
|
||||
@@ -231,9 +231,8 @@ void RenderableFov::render(const RenderData& data){
|
||||
|
||||
void RenderableFov::update(const UpdateData& data){
|
||||
|
||||
double lightTime;
|
||||
_time = data.time;
|
||||
_delta = data.delta;
|
||||
_delta = static_cast<int>(data.delta);
|
||||
|
||||
openspace::SpiceManager::ref().getPositionTransformMatrix("NH_SPACECRAFT", "GALACTIC", data.time, _stateMatrix);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ bool RenderablePath::fullYearSweep(){
|
||||
et += _increment;
|
||||
}
|
||||
_stride = 8;
|
||||
_vsize = _varray.size();
|
||||
_vsize = static_cast<unsigned int>(_varray.size());
|
||||
_vtotal = static_cast<int>(_vsize / _stride);
|
||||
return true;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ void RenderablePath::update(const UpdateData& data){
|
||||
double lightTime;
|
||||
|
||||
_time = data.time;
|
||||
_delta = data.delta;
|
||||
_delta = static_cast<int>(data.delta);
|
||||
|
||||
SpiceManager::ref().getTargetState(_target, _observer, _frame, "LT+S", data.time, _pscpos, _pscvel, lightTime);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
|
||||
dictionary.getValue(constants::renderablesphericalgrid::gridMatrix , _gridMatrix);
|
||||
dictionary.getValue(constants::renderablesphericalgrid::gridSegments, s);
|
||||
|
||||
_segments = s[0];
|
||||
_segments = static_cast<int>(s[0]);
|
||||
|
||||
_isize = int(6 * _segments * _segments);
|
||||
_vsize = int((_segments + 1) * (_segments + 1));
|
||||
|
||||
@@ -99,8 +99,8 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
void RenderableTrail::fullYearSweep(){
|
||||
double lightTime = 0.0;
|
||||
double et = _startTrail;
|
||||
double planetYear = 31540000 * _ratio;
|
||||
int segments = _tropic;
|
||||
float planetYear = 31540000.0f * _ratio;
|
||||
int segments = static_cast<int>(_tropic);
|
||||
|
||||
_increment = planetYear / _tropic;
|
||||
|
||||
@@ -134,7 +134,7 @@ void RenderableTrail::fullYearSweep(){
|
||||
et -= _increment;
|
||||
}
|
||||
_stride = 8;
|
||||
_vsize = _varray.size();
|
||||
_vsize = static_cast<unsigned int>(_varray.size());
|
||||
_vtotal = static_cast<int>(_vsize / _stride);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ bool RenderableTrail::initialize(){
|
||||
|
||||
// SpiceManager::ref().getETfromDate("2006 Aug 22 17:00:00", _startTrail);
|
||||
SpiceManager::ref().getETfromDate("2007 feb 26 17:30:00", _startTrail);
|
||||
_dtEt = _startTrail;
|
||||
_dtEt = static_cast<float>(_startTrail);
|
||||
|
||||
fullYearSweep();
|
||||
sendToGPU();
|
||||
@@ -309,8 +309,8 @@ void RenderableTrail::render(const RenderData& data){
|
||||
}
|
||||
|
||||
void RenderableTrail::update(const UpdateData& data){
|
||||
_time = data.time;
|
||||
_delta = data.delta;
|
||||
_time = static_cast<float>(data.time);
|
||||
_delta = static_cast<int>(data.delta);
|
||||
|
||||
SpiceManager::ref().getTargetState(_target, _observer, _frame, "NONE", data.time, _pscpos, _pscvel, lightTime);
|
||||
_pscpos[3] += 3; // KM to M
|
||||
|
||||
@@ -152,12 +152,12 @@ ghoul::opengl::Texture* RenderableVolume::loadVolume(
|
||||
float* data = new float[length];
|
||||
#ifdef VOLUME_LOAD_PROGRESSBAR
|
||||
LINFO("Loading cache: " << cachepath);
|
||||
ProgressBar pb(dimensions[2]);
|
||||
ProgressBar pb(static_cast<int>(dimensions[2]));
|
||||
for (size_t i = 0; i < dimensions[2]; ++i) {
|
||||
size_t offset = length / dimensions[2];
|
||||
std::streamsize offsetsize = sizeof(float)*offset;
|
||||
file.read(reinterpret_cast<char*>(data + offset * i), offsetsize);
|
||||
pb.print(i);
|
||||
pb.print(static_cast<int>(i));
|
||||
}
|
||||
#else
|
||||
file.read(reinterpret_cast<char*>(data), sizeof(float)*length);
|
||||
@@ -195,10 +195,11 @@ ghoul::opengl::Texture* RenderableVolume::loadVolume(
|
||||
|
||||
float* data = kw.getUniformSampledVectorValues(xVariable, yVariable, zVariable, dimensions);
|
||||
if(cache) {
|
||||
FILE* file = fopen (cachepath.c_str(), "wb");
|
||||
//FILE* file = fopen (cachepath.c_str(), "wb");
|
||||
std::ofstream file(cachepath, std::ios::in | std::ios::binary);
|
||||
size_t length = dimensions[0] * dimensions[1] * dimensions[2];
|
||||
fwrite(data, sizeof(float), length, file);
|
||||
fclose(file);
|
||||
file.write(reinterpret_cast<char*>(data), sizeof(float)*length);
|
||||
file.close();
|
||||
}
|
||||
|
||||
return new ghoul::opengl::Texture(data, dimensions, ghoul::opengl::Texture::Format::RGBA, GL_RGBA, GL_FLOAT, filtermode, wrappingmode);
|
||||
|
||||
@@ -126,9 +126,9 @@ RenderableVolumeGL::RenderableVolumeGL(const ghoul::Dictionary& dictionary)
|
||||
_boxScaling = kw.getModelScale();
|
||||
if (std::get<0>(t) == "R" && std::get<1>(t) == "R" && std::get<2>(t) == "R") {
|
||||
// Earth radius
|
||||
_boxScaling.x *= 6.371;
|
||||
_boxScaling.y *= 6.371;
|
||||
_boxScaling.z *= 6.371;
|
||||
_boxScaling.x *= 6.371f;
|
||||
_boxScaling.y *= 6.371f;
|
||||
_boxScaling.z *= 6.371f;
|
||||
_w = 6;
|
||||
}
|
||||
else if (std::get<0>(t) == "m" && std::get<1>(t) == "radian" && std::get<2>(t) == "radian") {
|
||||
@@ -143,9 +143,9 @@ RenderableVolumeGL::RenderableVolumeGL(const ghoul::Dictionary& dictionary)
|
||||
_pscOffset = kw.getModelBarycenterOffset();
|
||||
if (std::get<0>(t) == "R" && std::get<1>(t) == "R" && std::get<2>(t) == "R") {
|
||||
// Earth radius
|
||||
_pscOffset[0] *= 6.371;
|
||||
_pscOffset[1] *= 6.371;
|
||||
_pscOffset[2] *= 6.371;
|
||||
_pscOffset[0] *= 6.371f;
|
||||
_pscOffset[1] *= 6.371f;
|
||||
_pscOffset[2] *= 6.371f;
|
||||
_pscOffset[3] = 6;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -666,7 +666,7 @@ void RenderEngine::storePerformanceMeasurements() {
|
||||
PerformanceLayoutEntry entries[maxValues];
|
||||
};
|
||||
|
||||
const int nNodes = sceneGraph()->allSceneGraphNodes().size();
|
||||
const int nNodes = static_cast<int>(sceneGraph()->allSceneGraphNodes().size());
|
||||
if (!_performanceMemory) {
|
||||
|
||||
// Compute the total size
|
||||
|
||||
@@ -256,7 +256,7 @@ void SceneGraphNode::render(const RenderData& data) {
|
||||
|
||||
RenderData newData = {data.camera, thisPosition, data.doPerformanceMeasurement};
|
||||
|
||||
_performanceRecord.renderTime = 0.f;
|
||||
_performanceRecord.renderTime = 0;
|
||||
if (_renderableVisible && _renderable->isVisible() && _renderable->isReady() && _renderable->isEnabled()) {
|
||||
if (data.doPerformanceMeasurement) {
|
||||
glFinish();
|
||||
|
||||
@@ -152,7 +152,7 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
assert(outDimensions.x > 0 && outDimensions.y > 0 && outDimensions.z > 0);
|
||||
LINFO("Loading variable " << var << " from CDF data with a uniform sampling");
|
||||
|
||||
int size = outDimensions.x*outDimensions.y*outDimensions.z;
|
||||
unsigned int size = static_cast<unsigned int>(outDimensions.x*outDimensions.y*outDimensions.z);
|
||||
float* data = new float[size];
|
||||
double* doubleData = new double[size];
|
||||
|
||||
@@ -168,7 +168,7 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
|
||||
// HISTOGRAM
|
||||
const int bins = 200;
|
||||
const float truncLim = 0.9;
|
||||
const float truncLim = 0.9f;
|
||||
std::vector<int> histogram (bins,0);
|
||||
auto mapToHistogram = [varMin, varMax, bins](double val) {
|
||||
double zeroToOne = (val-varMin)/(varMax-varMin);
|
||||
@@ -178,14 +178,14 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
return glm::clamp(izerotoone, 0, bins-1);
|
||||
};
|
||||
|
||||
ProgressBar pb(outDimensions.x);
|
||||
ProgressBar pb(static_cast<int>(outDimensions.x));
|
||||
for (int x = 0; x < outDimensions.x; ++x) {
|
||||
pb.print(x);
|
||||
|
||||
for (int y = 0; y < outDimensions.y; ++y) {
|
||||
for (int z = 0; z < outDimensions.z; ++z) {
|
||||
|
||||
int index = x + y*outDimensions.x + z*outDimensions.x*outDimensions.y;
|
||||
unsigned int index = static_cast<unsigned int>(x + y*outDimensions.x + z*outDimensions.x*outDimensions.y);
|
||||
|
||||
if (_gridType == GridType::Spherical) {
|
||||
// Put r in the [0..sqrt(3)] range
|
||||
@@ -223,7 +223,11 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
// Convert from [0, 2pi] rad to [0, 360] degrees
|
||||
phiPh = phiPh*180.f/M_PI;
|
||||
// Sample
|
||||
value = _interpolator->interpolate(var, rPh, thetaPh, phiPh);
|
||||
value = _interpolator->interpolate(
|
||||
var,
|
||||
static_cast<float>(rPh),
|
||||
static_cast<float>(thetaPh),
|
||||
static_cast<float>(phiPh));
|
||||
// value = _interpolator->interpolate(var, rPh, phiPh, thetaPh);
|
||||
}
|
||||
|
||||
@@ -246,7 +250,11 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
|
||||
// get interpolated data value for (xPos, yPos, zPos)
|
||||
// swap yPos and zPos because model has Z as up
|
||||
double value = _interpolator->interpolate(var, xPos, zPos, yPos);
|
||||
double value = _interpolator->interpolate(
|
||||
var,
|
||||
static_cast<float>(xPos),
|
||||
static_cast<float>(zPos),
|
||||
static_cast<float>(yPos));
|
||||
doubleData[index] = value;
|
||||
histogram[mapToHistogram(value)]++;
|
||||
}
|
||||
@@ -275,7 +283,7 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
|
||||
int sum = 0;
|
||||
int stop = 0;
|
||||
const int sumuntil = size * truncLim;
|
||||
const int sumuntil = static_cast<int>(static_cast<float>(size) * truncLim);
|
||||
for(int i = 0; i < bins; ++i) {
|
||||
sum += histogram[i];
|
||||
if(sum > sumuntil) {
|
||||
@@ -292,7 +300,7 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
varMax = varMin + dist;
|
||||
//LDEBUG(var << "Min: " << varMin);
|
||||
//LDEBUG(var << "Max: " << varMax);
|
||||
for(int i = 0; i < size; ++i) {
|
||||
for(size_t i = 0; i < size; ++i) {
|
||||
double normalizedVal = (doubleData[i]-varMin)/(varMax-varMin);
|
||||
|
||||
data[i] = static_cast<float>(glm::clamp(normalizedVal, 0.0, 1.0));
|
||||
@@ -325,7 +333,7 @@ float* KameleonWrapper::getUniformSampledVectorValues(
|
||||
LINFO("Loading variables " << xVar << " " << yVar << " " << zVar << " from CDF data with a uniform sampling");
|
||||
|
||||
int channels = 4;
|
||||
int size = channels*outDimensions.x*outDimensions.y*outDimensions.z;
|
||||
unsigned int size = static_cast<unsigned int>(channels*outDimensions.x*outDimensions.y*outDimensions.z);
|
||||
float* data = new float[size];
|
||||
|
||||
float varXMin = _model->getVariableAttribute(xVar, "actual_min").getAttributeFloat();
|
||||
@@ -346,14 +354,14 @@ float* KameleonWrapper::getUniformSampledVectorValues(
|
||||
//LDEBUG(zVar << "Min: " << varZMin);
|
||||
//LDEBUG(zVar << "Max: " << varZMax);
|
||||
|
||||
ProgressBar pb(outDimensions.x);
|
||||
ProgressBar pb(static_cast<int>(outDimensions.x));
|
||||
for (int x = 0; x < outDimensions.x; ++x) {
|
||||
pb.print(x);
|
||||
|
||||
for (int y = 0; y < outDimensions.y; ++y) {
|
||||
for (int z = 0; z < outDimensions.z; ++z) {
|
||||
|
||||
int index = x*channels + y*channels*outDimensions.x + z*channels*outDimensions.x*outDimensions.y;
|
||||
unsigned int index = static_cast<unsigned int>(x*channels + y*channels*outDimensions.x + z*channels*outDimensions.x*outDimensions.y);
|
||||
|
||||
if(_gridType == GridType::Cartesian) {
|
||||
float xPos = _xMin + stepX*x;
|
||||
@@ -475,7 +483,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getLorentzTrajectories(
|
||||
minusTraj = traceLorentzTrajectory(seedPoint, stepsize, -1.0);
|
||||
|
||||
//minusTraj.erase(minusTraj.begin());
|
||||
int plusNum = plusTraj.size();
|
||||
size_t plusNum = plusTraj.size();
|
||||
minusTraj.insert(minusTraj.begin(), plusTraj.rbegin(), plusTraj.rend());
|
||||
|
||||
// write colors and convert positions to meter
|
||||
@@ -581,21 +589,21 @@ KameleonWrapper::TraceLine KameleonWrapper::traceCartesianFieldline(
|
||||
k1.z = _interpolator->interpolate(zID, pos.x, pos.y, pos.z);
|
||||
k1 = (float)direction*glm::normalize(k1);
|
||||
stepX=stepX*stepSize, stepY=stepY*stepSize, stepZ=stepZ*stepSize;
|
||||
k2.x = _interpolator->interpolate(xID, pos.x+(stepX/2.0)*k1.x, pos.y+(stepY/2.0)*k1.y, pos.z+(stepZ/2.0)*k1.z);
|
||||
k2.y = _interpolator->interpolate(yID, pos.x+(stepX/2.0)*k1.x, pos.y+(stepY/2.0)*k1.y, pos.z+(stepZ/2.0)*k1.z);
|
||||
k2.z = _interpolator->interpolate(zID, pos.x+(stepX/2.0)*k1.x, pos.y+(stepY/2.0)*k1.y, pos.z+(stepZ/2.0)*k1.z);
|
||||
k2.x = _interpolator->interpolate(xID, pos.x+(stepX/2.0f)*k1.x, pos.y+(stepY/2.0f)*k1.y, pos.z+(stepZ/2.0f)*k1.z);
|
||||
k2.y = _interpolator->interpolate(yID, pos.x+(stepX/2.0f)*k1.x, pos.y+(stepY/2.0f)*k1.y, pos.z+(stepZ/2.0f)*k1.z);
|
||||
k2.z = _interpolator->interpolate(zID, pos.x+(stepX/2.0f)*k1.x, pos.y+(stepY/2.0f)*k1.y, pos.z+(stepZ/2.0f)*k1.z);
|
||||
k2 = (float)direction*glm::normalize(k2);
|
||||
k3.x = _interpolator->interpolate(xID, pos.x+(stepX/2.0)*k2.x, pos.y+(stepY/2.0)*k2.y, pos.z+(stepZ/2.0)*k2.z);
|
||||
k3.y = _interpolator->interpolate(yID, pos.x+(stepX/2.0)*k2.x, pos.y+(stepY/2.0)*k2.y, pos.z+(stepZ/2.0)*k2.z);
|
||||
k3.z = _interpolator->interpolate(zID, pos.x+(stepX/2.0)*k2.x, pos.y+(stepY/2.0)*k2.y, pos.z+(stepZ/2.0)*k2.z);
|
||||
k3.x = _interpolator->interpolate(xID, pos.x+(stepX/2.0f)*k2.x, pos.y+(stepY/2.0f)*k2.y, pos.z+(stepZ/2.0f)*k2.z);
|
||||
k3.y = _interpolator->interpolate(yID, pos.x+(stepX/2.0f)*k2.x, pos.y+(stepY/2.0f)*k2.y, pos.z+(stepZ/2.0f)*k2.z);
|
||||
k3.z = _interpolator->interpolate(zID, pos.x+(stepX/2.0f)*k2.x, pos.y+(stepY/2.0f)*k2.y, pos.z+(stepZ/2.0f)*k2.z);
|
||||
k3 = (float)direction*glm::normalize(k3);
|
||||
k4.x = _interpolator->interpolate(xID, pos.x+stepX*k3.x, pos.y+stepY*k3.y, pos.z+stepZ*k3.z);
|
||||
k4.y = _interpolator->interpolate(yID, pos.x+stepX*k3.x, pos.y+stepY*k3.y, pos.z+stepZ*k3.z);
|
||||
k4.z = _interpolator->interpolate(zID, pos.x+stepX*k3.x, pos.y+stepY*k3.y, pos.z+stepZ*k3.z);
|
||||
k4 = (float)direction*glm::normalize(k4);
|
||||
pos.x = pos.x + (stepX/6.0)*(k1.x + 2.0*k2.x + 2.0*k3.x + k4.x);
|
||||
pos.y = pos.y + (stepY/6.0)*(k1.y + 2.0*k2.y + 2.0*k3.y + k4.y);
|
||||
pos.z = pos.z + (stepZ/6.0)*(k1.z + 2.0*k2.z + 2.0*k3.z + k4.z);
|
||||
pos.x = pos.x + (stepX/6.0f)*(k1.x + 2.0f*k2.x + 2.0f*k3.x + k4.x);
|
||||
pos.y = pos.y + (stepY/6.0f)*(k1.y + 2.0f*k2.y + 2.0f*k3.y + k4.y);
|
||||
pos.z = pos.z + (stepZ/6.0f)*(k1.z + 2.0f*k2.z + 2.0f*k3.z + k4.z);
|
||||
|
||||
++numSteps;
|
||||
if (numSteps > maxSteps) {
|
||||
@@ -692,13 +700,13 @@ KameleonWrapper::TraceLine KameleonWrapper::traceLorentzTrajectory(
|
||||
k4 = eCharge*(E + glm::cross(tmpV, B));
|
||||
k4 = glm::normalize(k4);
|
||||
|
||||
pos.x = pos.x + stepX*v0.x + (stepX*stepX/6.0)*(k1.x + k2.x + k3.x);
|
||||
pos.y = pos.y + stepY*v0.y + (stepY*stepY/6.0)*(k1.y + k2.y + k3.y);
|
||||
pos.z = pos.z + stepZ*v0.z + (stepZ*stepZ/6.0)*(k1.z + k2.z + k3.z);
|
||||
pos.x = pos.x + stepX*v0.x + (stepX*stepX/6.0f)*(k1.x + k2.x + k3.x);
|
||||
pos.y = pos.y + stepY*v0.y + (stepY*stepY/6.0f)*(k1.y + k2.y + k3.y);
|
||||
pos.z = pos.z + stepZ*v0.z + (stepZ*stepZ/6.0f)*(k1.z + k2.z + k3.z);
|
||||
|
||||
v0.x = v0.x + (stepX/6.0)*(k1.x + 2.0*k2.x + 2.0*k3.x + k4.z);
|
||||
v0.y = v0.y + (stepY/6.0)*(k1.y + 2.0*k2.y + 2.0*k3.y + k4.y);
|
||||
v0.z = v0.z + (stepZ/6.0)*(k1.z + 2.0*k2.z + 2.0*k3.z + k4.z);
|
||||
v0.x = v0.x + (stepX/6.0f)*(k1.x + 2.0f*k2.x + 2.0f*k3.x + k4.z);
|
||||
v0.y = v0.y + (stepY/6.0f)*(k1.y + 2.0f*k2.y + 2.0f*k3.y + k4.y);
|
||||
v0.z = v0.z + (stepZ/6.0f)*(k1.z + 2.0f*k2.z + 2.0f*k3.z + k4.z);
|
||||
|
||||
++numSteps;
|
||||
if (numSteps > maxSteps) {
|
||||
|
||||
@@ -47,7 +47,7 @@ void ProgressBar::print(int current) {
|
||||
float progress = static_cast<float>(current) / static_cast<float>(_end - 1);
|
||||
int iprogress = static_cast<int>(progress*100.0f);
|
||||
if (iprogress != _previous) {
|
||||
int pos = _width * progress;
|
||||
int pos = static_cast<int>(static_cast<float>(_width)* progress);
|
||||
int eqWidth = pos + 1;
|
||||
int spWidth = _width - pos + 2;
|
||||
_stream << "[" << std::setfill('=') << std::setw(eqWidth)
|
||||
|
||||
Reference in New Issue
Block a user