TileFieldBase::TileFieldBase(spn::MTRandom& rd, const spn::PowInt n, const spn::PowInt vn, const float scale, const float height, const float height_att, const float th, const float mv) { _heightL = Displacement::MakeDisplacement(rd, n, height_att); Displacement::Smooth(_heightL, n, th, mv); _index = Displacement::MakeBuffer(Displacement::MakeIndex(vn)); _center = spn::Vec3(0); const int tw = n / vn; _width = scale / tw; _tileWidth = tw; _nLevel = _index.size(); _scale = {_width, height, _width}; setTextureRepeat(1.f); setStateNew<St_Default>(); }
textureT* createTexture(void) { textureT* tex = malloc(sizeof(textureT)); glGenTextures(1, &tex->id); tex->multisample = false; textureT* old_tex = useTexture(tex, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); setTextureRepeat(tex, false); useTexture(old_tex, 0); return (tex); }