+/**
+ * Adds a 3D cloud to a cloud layer.
+ *
+ * Property arguments
+ * layer - the layer index to add this cloud to. (Defaults to 0)
+ * index - the index for this cloud (to be used later)
+ * lon/lat/alt - the position for the cloud
+ * (Various) - cloud definition properties. See README.3DClouds
+ *
+ */
+ bool FGClouds::add3DCloud(const SGPropertyNode *arg)
+ {
+ int l = arg->getIntValue("layer", 0);
+ int index = arg->getIntValue("index", 0);
+
+ SGPath texture_root = globals->get_fg_root();
+ texture_root.append("Textures");
+ texture_root.append("Sky");
+
+ float lon = arg->getFloatValue("lon-deg", 0.0f);
+ float lat = arg->getFloatValue("lat-deg", 0.0f);
+ float alt = arg->getFloatValue("alt-ft", 0.0f);
+ float x = arg->getFloatValue("x-offset-m", 0.0f);
+ float y = arg->getFloatValue("y-offset-m", 0.0f);
+
+ SGSky* thesky = globals->get_renderer()->getSky();
+ SGCloudField *layer = thesky->get_cloud_layer(l)->get_layer3D();
+ SGNewCloud cld(texture_root, arg, &seed);
+ bool success = layer->addCloud(lon, lat, alt, x, y, index, cld.genCloud());
+
+ // Adding a 3D cloud immediately makes this layer 3D.
+ thesky->get_cloud_layer(l)->set_enable3dClouds(true);
+
+ return success;
+ }
+
+ /**
+ * Removes a 3D cloud from a cloud layer
+ *
+ * Property arguments
+ *
+ * layer - the layer index to remove this cloud from. (defaults to 0)
+ * index - the cloud index
+ *
+ */
+ bool FGClouds::delete3DCloud(const SGPropertyNode *arg)
+ {
+ int l = arg->getIntValue("layer", 0);
+ int i = arg->getIntValue("index", 0);
+
+ SGSky* thesky = globals->get_renderer()->getSky();
+ SGCloudField *layer = thesky->get_cloud_layer(l)->get_layer3D();
+ return layer->deleteCloud(i);
+ }
+
+/**
+ * Move a cloud within a 3D layer
+ *
+ * Property arguments
+ * layer - the layer index to add this cloud to. (Defaults to 0)
+ * index - the cloud index to move.
+ * lon/lat/alt - the position for the cloud
+ *
+ */
+bool FGClouds::move3DCloud(const SGPropertyNode *arg)
+ {
+ int l = arg->getIntValue("layer", 0);
+ int i = arg->getIntValue("index", 0);
+ SGSky* thesky = globals->get_renderer()->getSky();
+
+ float lon = arg->getFloatValue("lon-deg", 0.0f);
+ float lat = arg->getFloatValue("lat-deg", 0.0f);
+ float alt = arg->getFloatValue("alt-ft", 0.0f);
+ float x = arg->getFloatValue("x-offset-m", 0.0f);
+ float y = arg->getFloatValue("y-offset-m", 0.0f);
+
+ SGCloudField *layer = thesky->get_cloud_layer(l)->get_layer3D();
+ return layer->repositionCloud(i, lon, lat, alt, x, y);
+ }