static bspfile.dclipnode_t[] init_box_clip_nodes(int num) { var box_clipnodes = new bspfile.dclipnode_t[num]; for (int i = 0; i < num; i++) { box_clipnodes[i]=new bspfile.dclipnode_t(); } return box_clipnodes; }
/* ================= Mod_LoadClipnodes ================= */ private static void Mod_LoadClipnodes(bspfile.lump_t l) { bspfile.dclipnode_t[] @in, @out; int i, count; hull_t hull; if ((l.filelen % bspfile.sizeof_dclipnode_t) != 0) sys_linux.Sys_Error("MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / bspfile.sizeof_dclipnode_t; bspfile.ByteBuffer buf = new bspfile.ByteBuffer(mod_base, l.fileofs); @in = new bspfile.dclipnode_t[count]; @out = new bspfile.dclipnode_t[count]; for (int kk = 0; kk < count; kk++) { @in[kk] = (bspfile.dclipnode_t)buf; buf.ofs += bspfile.sizeof_dclipnode_t; @out[kk] = new bspfile.dclipnode_t(); } loadmodel.clipnodes = @out; loadmodel.numclipnodes = count; hull = loadmodel.hulls[1]; hull.clipnodes = @out; hull.firstclipnode = 0; hull.lastclipnode = count - 1; hull.planes = loadmodel.planes; hull.clip_mins[0] = -16; hull.clip_mins[1] = -16; hull.clip_mins[2] = -24; hull.clip_maxs[0] = 16; hull.clip_maxs[1] = 16; hull.clip_maxs[2] = 32; //Debug.WriteLine("@hull1 firstclipnode: " + hull.firstclipnode); hull = loadmodel.hulls[2]; hull.clipnodes = @out; hull.firstclipnode = 0; hull.lastclipnode = count - 1; hull.planes = loadmodel.planes; hull.clip_mins[0] = -32; hull.clip_mins[1] = -32; hull.clip_mins[2] = -24; hull.clip_maxs[0] = 32; hull.clip_maxs[1] = 32; hull.clip_maxs[2] = 64; //Debug.WriteLine("@hull2 firstclipnode: "+ hull.firstclipnode); for (i = 0; i < count; i++) { @out[i].planenum = @in[i].planenum; @out[i].children[0] = @in[i].children[0]; //LittleShort @out[i].children[1] = @in[i].children[1]; /*Debug.WriteLine( string.Format( " @planenum: {0}, @children[0]: {1}, @children[1]: {2}", @in[i].planenum, @in[i].children[0], @in[i].children[1]));*/ } }
public void Clone(model_t model) { this.name = model.name; this.needload = model.needload; this.type = model.type; this.numframes = model.numframes; this.flags = model.flags; this.mins = (double[])model.mins.Clone(); this.maxs = (double[])model.maxs.Clone(); this.radius = model.radius; this.firstmodelsurface = model.firstmodelsurface; this.nummodelsurfaces = model.nummodelsurfaces; this.numsubmodels = model.numsubmodels; this.submodels = model.submodels; this.numplanes = model.numplanes; this.planes = model.planes; this.numleafs = model.numleafs; this.leafs = model.leafs; this.numvertexes = model.numvertexes; this.vertexes = model.vertexes; this.numedges = model.numedges; this.edges = model.edges; this.numnodes = model.numnodes; this.nodes = model.nodes; this.numtexinfo = model.numtexinfo; this.texinfo = model.texinfo; this.numsurfaces = model.numsurfaces; this.surfaces = model.surfaces; this.numsurfedges = model.numsurfedges; this.surfedges = model.surfedges; this.numclipnodes = model.numclipnodes; this.clipnodes = model.clipnodes; this.nummarksurfaces = model.nummarksurfaces; this.marksurfaces = model.marksurfaces; this.hulls = model.hulls; this.numtextures = model.numtextures; this.textures = model.textures; this.visdata = model.visdata; this.lightdata = model.lightdata; this.entities = model.entities; }
/* ================= Mod_MakeHull0 Deplicate the drawing hull structure as a clipping hull ================= */ static void Mod_MakeHull0() { mnode_t[] @in; node_or_leaf_t child; bspfile.dclipnode_t[] @out; int i, j, count; hull_t hull; hull = loadmodel.hulls[0]; @in = loadmodel.nodes; count = loadmodel.numnodes; //@out = Hunk_AllocName ( count*sizeof(*@out), loadname); @out = new bspfile.dclipnode_t[count]; for (int kk = 0; kk < count; kk++) { //@in[kk] = (bspfile.dleaf_t)buf; //buf.ofs += bspfile.sizeof_dleaf_t; @out[kk] = new bspfile.dclipnode_t(); } hull.clipnodes = @out; hull.firstclipnode = 0; hull.lastclipnode = count-1; hull.planes = loadmodel.planes; for (i=0 ; i<count ; i++) { for (int k = 0; k < loadmodel.planes.Length; k++) { var plane = loadmodel.planes[k]; if (@in[i].plane == plane) { @out[i].planenum = k; break; } } //Debug.WriteLine("out.planeum " + @out[i].planenum); for (j = 0; j < 2; j++) { child = @in[i].children[j]; if (child.contents < 0) { //Debug.WriteLine("1"); @out[i].children[j] = child.contents; } else { //Debug.WriteLine("2"); for (int k = 0; k < loadmodel.nodes.Length; k++) { mnode_t node = loadmodel.nodes[k]; if (child == node) { @out[i].children[j] = k; break; } } } //Debug.WriteLine("out[i].children[j] " + @out[i].children[j]); } } }