// Object Creation Function Definitions std::vector<std::shared_ptr<Shape>> MakeShapes(const std::string &name, const Transform *object2world, const Transform *world2object, bool reverseOrientation, const ParamSet ¶mSet) { std::vector<std::shared_ptr<Shape>> shapes; std::shared_ptr<Shape> s; if (name == "sphere") s = CreateSphereShape(object2world, world2object, reverseOrientation, paramSet); // Create remaining single _Shape_ types else if (name == "cylinder") s = CreateCylinderShape(object2world, world2object, reverseOrientation, paramSet); else if (name == "disk") s = CreateDiskShape(object2world, world2object, reverseOrientation, paramSet); else if (name == "cone") s = CreateConeShape(object2world, world2object, reverseOrientation, paramSet); else if (name == "paraboloid") s = CreateParaboloidShape(object2world, world2object, reverseOrientation, paramSet); else if (name == "hyperboloid") s = CreateHyperboloidShape(object2world, world2object, reverseOrientation, paramSet); if (s != nullptr) shapes.push_back(s); // Create multiple-_Shape_ types else if (name == "curve") shapes = CreateCurveShape(object2world, world2object, reverseOrientation, paramSet); else if (name == "trianglemesh") shapes = CreateTriangleMeshShape(object2world, world2object, reverseOrientation, paramSet, &graphicsState.floatTextures); else if (name == "plymesh") shapes = CreatePLYMesh(object2world, world2object, reverseOrientation, paramSet, &graphicsState.floatTextures); else if (name == "heightfield") shapes = CreateHeightfield(object2world, world2object, reverseOrientation, paramSet); else if (name == "loopsubdiv") shapes = CreateLoopSubdiv(object2world, world2object, reverseOrientation, paramSet); else if (name == "nurbs") shapes = CreateNURBS(object2world, world2object, reverseOrientation, paramSet); else Warning("Shape \"%s\" unknown.", name.c_str()); paramSet.ReportUnused(); return shapes; }
//================================================================================================================================================================ void OceanHeightfield::Initialize() { // // Create the heightfield and Initialize some parameters // heightfield_size = (ocean_params.displacement_map_dim + 4) * (ocean_params.displacement_map_dim + 1); h0_data = new D3DXVECTOR2[heightfield_size * sizeof(D3DXVECTOR2)]; omega_data = new float[heightfield_size * sizeof(float)]; heightfield_dim = ocean_params.displacement_map_dim; input_full_size = (heightfield_dim + 4) * (heightfield_dim + 1); input_half_size = (heightfield_dim / 2 + 1) * heightfield_dim; output_size = heightfield_dim * heightfield_dim; zero_data_size = 3 * output_size * sizeof(float) * 2; float2_stride = 2 * sizeof(float); CreateHeightfield(h0_data, omega_data); }