void ot_newroot(OT_NODE **root_ptr) { OT_NODE *newroot; int dx, dy, dz, index; newroot = (OT_NODE *)POV_CALLOC(1, sizeof(OT_NODE), "octree node"); #ifdef RADSTATS ot_nodecount++; #endif ot_parent(&newroot->Id, &((*root_ptr)->Id)); // sets the x/y/z/size id // Function: decide which child of the new root the old root is. Theory: // x,y,z values are measured in block sizes, and are a factor of 2 smaller // at each level higher. The parent of both (3,4,5,k) and (2,5,4,k) is // (1,2,2,k+1), so the oddness of the child's ordinates determines which // child it is, and hence the value of the index into the parent's array of // children. First half of array (4 entries) is kids with low/even x; // First half of those is kids with low/even y (2 entries), and the very // first entry is the one with low/even everything. dx = ((*root_ptr)->Id.x & 1) * 4; dy = ((*root_ptr)->Id.y & 1) * 2; dz = ((*root_ptr)->Id.z & 1); index = dx + dy + dz; newroot->Kids[index] = *root_ptr; *root_ptr = newroot; // CLi moved C99_COMPATIBLE_RADIOSITY check from ot_newroot() to ot_ins() NULL root handling section // (no need to do this again and again for every new node inserted) }
BLEND_MAP_ENTRY *Create_BMap_Entries (int Map_Size) { BLEND_MAP_ENTRY *New; New = (BLEND_MAP_ENTRY *)POV_CALLOC(Map_Size, sizeof (BLEND_MAP_ENTRY), "blend map entry"); return (New); }
BLEND_MAP_ENTRY *Create_BMap_Entries (int Map_Size) { BLEND_MAP_ENTRY *New; New = reinterpret_cast<BLEND_MAP_ENTRY *>(POV_CALLOC(Map_Size, sizeof (BLEND_MAP_ENTRY), "blend map entry")); return (New); }
IMAGE *Create_Image() { IMAGE *Image; Image = (IMAGE *) POV_CALLOC(1, sizeof(IMAGE), "image file"); Image->References = 1; Image->File_Type = NO_FILE; Image->Image_Type = 0; Image->Map_Type = PLANAR_MAP; Image->Interpolation_Type = NO_INTERPOLATION; Image->iwidth = Image->iheight = 0; Image->width = Image->height = 0.0; Image->Once_Flag = false; Make_UV_Vector(Image->Offset,0.0,0.0); Image->Use_Colour_Flag = false; Make_Vector(Image->Gradient, 1.0, -1.0, 0.0); Image->AllFilter = 0; Image->AllTransmit = 0; Image->Colour_Map_Size = 0; Image->Colour_Map = NULL; Image->Object = NULL; return (Image); }