void Destroy_Blend_Map (BLEND_MAP *BMap) { int i; if (BMap != NULL) { if (--(BMap->Users) == 0) { for (i = 0; i < BMap->Number_Of_Entries; i++) { switch (BMap->Type) { case PIGMENT_TYPE: case DENSITY_TYPE: Destroy_Pigment(BMap->Blend_Map_Entries[i].Vals.Pigment); break; case NORMAL_TYPE: Destroy_Tnormal(BMap->Blend_Map_Entries[i].Vals.Tnormal); break; case TEXTURE_TYPE: Destroy_Textures(BMap->Blend_Map_Entries[i].Vals.Texture); } } POV_FREE (BMap->Blend_Map_Entries); POV_FREE (BMap); } } }
CAMERA *Copy_Camera(CAMERA *Old) { CAMERA *New; if (Old != NULL) { New = Create_Camera(); Destroy_Tnormal(New->Tnormal); Destroy_Transform(New->Trans); *New = *Old; New->Tnormal = NULL; // clear in case the copy fails if(Old->Tnormal != NULL) New->Tnormal = Copy_Tnormal(Old->Tnormal); New->Trans = NULL; // clear in case the copy fails if(Old->Trans != NULL) New->Trans = Copy_Transform(Old->Trans); } else { New = NULL; } return (New); }
Camera::~Camera() { Destroy_Tnormal(Tnormal); Destroy_Transform(Trans); Destroy_Pigment(Bokeh); for (std::vector<ObjectPtr>::iterator it = Meshes.begin(); it != Meshes.end(); it++) Destroy_Object(*it); Meshes.clear(); }
void Destroy_Camera(CAMERA *Camera) { if (Camera != NULL) { Destroy_Tnormal(Camera->Tnormal); Destroy_Transform(Camera->Trans); POV_FREE(Camera); } }
Camera& Camera::operator=(const Camera& src) { Assign_Vector(Location, src.Location); Assign_Vector(Direction, src.Direction); Assign_Vector(Up, src.Up); Assign_Vector(Right, src.Right); Assign_Vector(Sky, src.Sky); Assign_Vector(Look_At, src.Look_At); Assign_Vector(Focal_Point, src.Focal_Point); Focal_Distance = src.Focal_Distance; Aperture = src.Aperture; Blur_Samples = src.Blur_Samples; Blur_Samples_Min = src.Blur_Samples_Min; Confidence = src.Confidence; Variance = src.Variance; Type = src.Type; Angle = src.Angle; H_Angle = src.H_Angle; V_Angle = src.V_Angle; if (Tnormal != NULL) Destroy_Tnormal(Tnormal); Tnormal = src.Tnormal ? Copy_Tnormal(src.Tnormal) : NULL; if (Trans != NULL) Destroy_Transform(Trans); Trans = src.Trans ? Copy_Transform(src.Trans) : NULL; if (Bokeh != NULL) Destroy_Pigment(Bokeh); Bokeh = src.Bokeh ? Copy_Pigment(src.Bokeh) : NULL; for (std::vector<ObjectPtr>::iterator it = Meshes.begin(); it != Meshes.end(); it++) Destroy_Object(*it); Meshes.clear(); for (std::vector<ObjectPtr>::const_iterator it = src.Meshes.begin(); it != src.Meshes.end(); it++) Meshes.push_back(Copy_Object(*it)); Face_Distribution_Method = src.Face_Distribution_Method; Rays_Per_Pixel = src.Rays_Per_Pixel; Max_Ray_Distance = src.Max_Ray_Distance; Mesh_Index = src.Mesh_Index; for (int i = 0; i < 10; i++) { U_Xref[i] = src.U_Xref[i]; V_Xref[i] = src.V_Xref[i]; } Smooth = src.Smooth; return *this; }
NormalBlendMap::~NormalBlendMap() { POV_BLEND_MAP_ASSERT(Type == kBlendMapType_Normal); for (Vector::iterator i = Blend_Map_Entries.begin(); i != Blend_Map_Entries.end(); i++) Destroy_Tnormal(i->Vals); }