Coding style

This commit is contained in:
Michaël Lemaire 2015-12-24 00:16:50 +01:00
parent d88cb29f4c
commit 77ba82408d
7 changed files with 16 additions and 11 deletions

View file

@ -30,9 +30,9 @@ static double g1[B + B + 2];
#define setup(i, b0, b1, r0, r1) \
t = vec[i] + N; \
b0 = trunc_to_int(t) & BM; \
b0 = trunc_to_int(t) & BM; \
b1 = (b0 + 1) & BM; \
r0 = t - trunc_to_int(t); \
r0 = t - trunc_to_int(t); \
r1 = r0 - 1.;
double noisePerlinGet1DValue(double x) {

View file

@ -18,7 +18,7 @@ void Layers::save(PackStream *stream) const {
int layer_count = static_cast<int>(layers.size());
stream->write(&layer_count);
for (auto &layer: layers) {
for (auto &layer : layers) {
stream->write(layer->getName());
layer->save(stream);
}

View file

@ -114,8 +114,8 @@ static void addBranchRecurse(RandomGenerator &random, vector<CappedCylinder> &br
Matrix4 pivot1 = Matrix4::newRotateAxis(randomizeValue(random, 1.0 - 0.6 * length, 0.9, 1.1), VECTOR_EAST);
Vector3 new_direction = pivot1.multPoint(direction);
for (int i = 0; i < split_count; i++) {
Matrix4 pivot2 =
Matrix4::newRotateAxis(randomizeValue(random, M_PI * 2.0 / to_double(split_count), 0.9, 1.1), direction);
Matrix4 pivot2 = Matrix4::newRotateAxis(
randomizeValue(random, M_PI * 2.0 / to_double(split_count), 0.9, 1.1), direction);
new_direction = pivot2.multPoint(new_direction);
Vector3 new_base = base.add(direction.scale(randomizeValue(random, length, 0.4, 1.0)));

View file

@ -127,7 +127,8 @@ int main(int argc, char **argv) {
scenery->autoPreset();
}
Logs::debug("CommandLine") << "Rendered scenery :" << endl << scenery->toString() << endl;
Logs::debug("CommandLine") << "Rendered scenery :" << endl
<< scenery->toString() << endl;
TimeManager time;
time.setWind(conf_wind_x, conf_wind_z);

View file

@ -252,7 +252,9 @@ void OpenGLRenderer::cameraChangeEvent(CameraDefinition *camera) {
// Set in shaders
shared_state->set("cameraLocation", location);
float *matdata = view_matrix->transposed().data();
shared_state->set("viewMatrix", Matrix4(matdata[0], matdata[1], matdata[2], matdata[3], matdata[4], matdata[5], matdata[6], matdata[7], matdata[8], matdata[9], matdata[10], matdata[11], matdata[12], matdata[13], matdata[14], matdata[15]));
shared_state->set("viewMatrix", Matrix4(matdata[0], matdata[1], matdata[2], matdata[3], matdata[4], matdata[5],
matdata[6], matdata[7], matdata[8], matdata[9], matdata[10], matdata[11],
matdata[12], matdata[13], matdata[14], matdata[15]));
// Broadcast to parts
vegetation->cameraChanged(camera);
@ -270,7 +272,8 @@ void OpenGLRenderer::updateMouseProjection() {
GLfloat z;
functions->glReadPixels(mouse_x, mouse_y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
QVector4D located(to_float(mouse_x / render_camera->getWidth()), to_float(mouse_y / render_camera->getHeight()), z, 1.0);
QVector4D located(to_float(mouse_x / render_camera->getWidth()), to_float(mouse_y / render_camera->getHeight()), z,
1.0);
QVector4D unprojected = view_matrix->inverted() * 2.0 * (located - QVector4D(0.5, 0.5, 0.5, 0.5));
*mouse_projected = Vector3(unprojected.x() / unprojected.w(), unprojected.y() / unprojected.w(),
unprojected.z() / unprojected.w());

View file

@ -141,7 +141,8 @@ void OpenGLVegetationImpostor::setVertex(int i, float u, float v) {
Matrix4 rotation = matrixForIndex(index);
Vector3 vertex = rotation.multPoint(Vector3(1.0, u, -(v - 0.5)));
vertices->set(index * 4 + i, vertex, (u + to_double(px)) / to_double(parts), (v + to_double(py)) / to_double(parts));
vertices->set(index * 4 + i, vertex, (u + to_double(px)) / to_double(parts),
(v + to_double(py)) / to_double(parts));
}
}
}

View file

@ -453,7 +453,7 @@ static void _inscatter1(double r, double mu, double muS, double nu, Color *ray,
_integrand1(r, mu, muS, nu, 0.0, &rayi, &miei);
int i;
for (i = 1; i <= INSCATTER_INTEGRAL_SAMPLES; ++i) {
double xj = to_double(i)*dx;
double xj = to_double(i) * dx;
Color rayj;
Color miej;
_integrand1(r, mu, muS, nu, xj, &rayj, &miej);
@ -703,7 +703,7 @@ static Color _inscatterN(Texture4D *deltaJ, double r, double mu, double muS, dou
Color raymiei = _integrand2(deltaJ, r, mu, muS, nu, 0.0);
int i;
for (i = 1; i <= INSCATTER_INTEGRAL_SAMPLES; ++i) {
double xj = to_double(i)*dx;
double xj = to_double(i) * dx;
Color raymiej = _integrand2(deltaJ, r, mu, muS, nu, xj);
raymie.r += (raymiei.r + raymiej.r) / 2.0 * dx;
raymie.g += (raymiei.g + raymiej.g) / 2.0 * dx;