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

@ -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); Matrix4 pivot1 = Matrix4::newRotateAxis(randomizeValue(random, 1.0 - 0.6 * length, 0.9, 1.1), VECTOR_EAST);
Vector3 new_direction = pivot1.multPoint(direction); Vector3 new_direction = pivot1.multPoint(direction);
for (int i = 0; i < split_count; i++) { for (int i = 0; i < split_count; i++) {
Matrix4 pivot2 = Matrix4 pivot2 = Matrix4::newRotateAxis(
Matrix4::newRotateAxis(randomizeValue(random, M_PI * 2.0 / to_double(split_count), 0.9, 1.1), direction); randomizeValue(random, M_PI * 2.0 / to_double(split_count), 0.9, 1.1), direction);
new_direction = pivot2.multPoint(new_direction); new_direction = pivot2.multPoint(new_direction);
Vector3 new_base = base.add(direction.scale(randomizeValue(random, length, 0.4, 1.0))); 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(); scenery->autoPreset();
} }
Logs::debug("CommandLine") << "Rendered scenery :" << endl << scenery->toString() << endl; Logs::debug("CommandLine") << "Rendered scenery :" << endl
<< scenery->toString() << endl;
TimeManager time; TimeManager time;
time.setWind(conf_wind_x, conf_wind_z); time.setWind(conf_wind_x, conf_wind_z);

View file

@ -252,7 +252,9 @@ void OpenGLRenderer::cameraChangeEvent(CameraDefinition *camera) {
// Set in shaders // Set in shaders
shared_state->set("cameraLocation", location); shared_state->set("cameraLocation", location);
float *matdata = view_matrix->transposed().data(); 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 // Broadcast to parts
vegetation->cameraChanged(camera); vegetation->cameraChanged(camera);
@ -270,7 +272,8 @@ void OpenGLRenderer::updateMouseProjection() {
GLfloat z; GLfloat z;
functions->glReadPixels(mouse_x, mouse_y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &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)); 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(), *mouse_projected = Vector3(unprojected.x() / unprojected.w(), unprojected.y() / unprojected.w(),
unprojected.z() / 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); Matrix4 rotation = matrixForIndex(index);
Vector3 vertex = rotation.multPoint(Vector3(1.0, u, -(v - 0.5))); 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));
} }
} }
} }