Smaller Hydrax Plane


01-02-2010 20:59:54

Is there anyway of making the hydrax plane smaller? fps in my project is taking a bit of a hit.


03-02-2010 06:36:00

Yup, use one of the grid geometries. The example which you may be basing your project off of uses the projected grid which is an infinite ocean expanse.

Changing this will involve swapping out the line of code where the projected grid is set, and then in a line above perhaps setting an options struct depending on which geometry you choose. It's clear if you take a look at the API.


03-02-2010 10:07:36

Thanks for the reply:D.
Would you be able to run me through a quick code example on how you would do this?


03-02-2010 14:10:04

This is using Hydrax v0.4, so it may vary depending on which version you have. First off, take a look at the Hydrax source you have (the stuff you compiled to make the Hydrax lib). Go to:

And see what modules you have available. For v0.4 it is ProjectedGrid and SimpleGrid. You may also have RadialGrid available. To get SimpleGrid working, you need to make at least the following changes (there may be more I'm forgetting!).

Step #1: We are no longer using the Project Grid module, so in the header files get rid of:

#include "Modules/SimpleGrid/ProjectedGrid.h"
And replace it with:

#include "Modules/SimpleGrid/SimpleGrid.h"

Now change the lines where the grid is invoked (just search for 'grid' in your code and go down to where it is). You will notice that using ProjectedGrid it was a single line because there are not too many parameters to pass in. Using SimpleGrid you need set a few options first. So in the lines above where you will call the grid:

// Set up the parameters to pass to SimpleGrid
const int complexity_num = 264;
const int mesh_size = 2100;
struct Hydrax::Size::Size mesh_struct;
struct Hydrax::Module::SimpleGrid::Options options_struct;
options_struct.Complexity = complexity_num;
options_struct.MeshSize = mesh_struct;

// Create our simple grid module
Hydrax::Module::SimpleGrid *mModule = new Hydrax::Module::SimpleGrid(
new Hydrax::Noise::Perlin(),

This all follows from the documentation, which can be found here:

Hopefully that will work out for you.


03-02-2010 14:51:11

Brilliant, works like a charm, thanks for the help! :)