I wish to use C++ as the only language I program in. Currently making a template to use for hex based strategy games. I originally was using gdscript to program in, but for reasons (mostly personal, partly performance) I would rather use C++.
Here is an example of the version I created using GDScript:

In GDNative, I can't set the material of the MeshInstance to a Ref<SpatialMaterial>, so although the game loads properly, the meshes are all white. Example:

How do I do this? Also, despite me seeding the C++ rand() function using time(0), the game will generate the same map everytime. How to fix?
Here is the relevant code:
if (_elevation < _waterThreshold) {
_meshInstance->set_surface_material(0, _waterMaterial);
_position.y = -0.125;
} else if (_elevation < _sandThreshold) {
_meshInstance->set_surface_material(0, _sandMaterial);
_position.y = 0;
} else if (_elevation < _plainsThreshold) {
_meshInstance->set_surface_material(0, _plainsMaterial);
_position.y = 0;
} else if (_elevation < _grassThreshold) {
_meshInstance->set_surface_material(0, _grassMaterial);
_position.y = 0;
} else if (_elevation < _mountainThreshold) {
_meshInstance->set_surface_material(0, _mountainMaterial);
_position.y = pow(1 + (_elevation - 0.225), 12.5) * 0.25;
} else {
_meshInstance->set_surface_material(0, _peakMaterial);
_position.y = pow(1 + (_elevation - 0.225), 12.5) * 0.25;
}
set_translation(_position);
_meshArray = pMeshArray;
_meshInstance->set_mesh(_meshArray);
add_child(_meshInstance);