Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport wave changes #557

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions examples/waves/GlutWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,6 @@ bool g_initContext = false;
GLXDrawable g_glutDrawable;
#endif

double g_offset = 0.0;

int g_seed[1] = {0};
float g_resolution[2] = {400, 200};
float g_color[3] = {1.0, 1.0, 1.0};
float g_adjustments[16] = {
0, 0, 0, 0.0005,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

// view control variables
ir::RayQueryPtr g_rayQuery;
ir::OrbitViewController g_viewControl;
Expand Down Expand Up @@ -341,9 +329,9 @@ void initCamera(ir::CameraPtr _camera)
void initUniforms()
{
ir::NodePtr node = g_camera->Parent();
ir::VisualPtr sphere =
ir::VisualPtr waves =
std::dynamic_pointer_cast<ir::Visual>(node->ChildByName("waves"));
ir::MaterialPtr shader = sphere->Material();
ir::MaterialPtr shader = waves->Material();
if (!shader)
return;

Expand Down Expand Up @@ -372,7 +360,7 @@ void initUniforms()
(*g_vsParams)["bumpSpeed"].InitializeBuffer(2);
(*g_vsParams)["bumpSpeed"].UpdateBuffer(bumpSpeed);

float amplitude = 0.7f;
float amplitude = 3.0f;
float amplitudeV[3] = {0.6f * amplitude, 0.4f * amplitude, 0.3f * amplitude};
(*g_vsParams)["amplitude"].InitializeBuffer(3);
(*g_vsParams)["amplitude"].UpdateBuffer(amplitudeV);
Expand Down
6 changes: 3 additions & 3 deletions examples/waves/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void buildScene(ScenePtr _scene, const std::string &_engineName)
shader->SetVertexShader(vertexShaderPath);
shader->SetFragmentShader(fragmentShaderPath);

// create box visual
// create waves visual
VisualPtr waves = _scene->CreateVisual("waves");
MeshDescriptor descriptor;
descriptor.meshName = common::joinPaths(RESOURCE_PATH, "mesh.dae");
Expand All @@ -100,11 +100,11 @@ void buildScene(ScenePtr _scene, const std::string &_engineName)

// create camera
CameraPtr camera = _scene->CreateCamera("camera");
camera->SetLocalPosition(0, 0.0, 0.5);
camera->SetLocalPosition(0, 0.0, 3.5);
camera->SetLocalRotation(0.0, 0.0, 0.0);
camera->SetImageWidth(800);
camera->SetImageHeight(600);
camera->SetAntiAliasing(2);
camera->SetAntiAliasing(4);
camera->SetAspectRatio(1.333);
camera->SetHFOV(IGN_PI / 2);
root->AddChild(camera);
Expand Down