/// <summary> /// Returns true if PdfSplitParameters instances are equal /// </summary> /// <param name="input">Instance of PdfSplitParameters to be compared</param> /// <returns>Boolean</returns> public bool Equals(PdfSplitParameters input) { if (input == null) { return(false); } return (( FileId == input.FileId || (FileId != null && FileId.Equals(input.FileId)) ) && ( SplitMethod == input.SplitMethod || SplitMethod.Equals(input.SplitMethod) ) && ( SplitValue == input.SplitValue || SplitValue.Equals(input.SplitValue) ) && ( ImmediateDownload == input.ImmediateDownload || ImmediateDownload.Equals(input.ImmediateDownload) )); }
public BVH(IPrimitive[] p, SplitMethod splitMethod, int maxPerNode = 1) { _p = p; SplitMethod = splitMethod; MaxPerNode = maxPerNode; var primitiveInfo = new BVHPrimitiveInfo[p.Length]; for (var i = 0; i < primitiveInfo.Length; ++i) { primitiveInfo[i] = new BVHPrimitiveInfo(i, p[i].WorldBounds); } var ordered = new List <IPrimitive>(p); var arena = new ObjectArena(); var totalNodes = 0; var root = splitMethod == SplitMethod.HLBVH ? HLBVHBuild(arena, primitiveInfo, out totalNodes, ordered) : RecursiveBuild(arena, primitiveInfo, 0, p.Length, ref totalNodes, ordered); _p = ordered.ToArray(); _nodes = new LinearBVHNode[totalNodes]; var offset = 0; FlattenBVHTree(root, ref offset); arena.Clear(); }
public BvhAccelerator(IEnumerable <Primitive> p, int maxPrimsInNode = 1, SplitMethod splitMethod = SplitMethod.SAH) { this.maxPrimsInNode = Math.Min(255, maxPrimsInNode); this.splitMethod = splitMethod; primitives = p.ToList(); //ProfilePhase _(Prof::AccelConstruction); if (!primitives.Any()) { return; } // Build BVH from _primitives_ // Initialize _primitiveInfo_ array for primitives List <BVHPrimitiveInfo> primitiveInfo = new List <BVHPrimitiveInfo>(primitives.Count); for (int i = 0; i < primitives.Count; ++i) { primitiveInfo[i] = new BVHPrimitiveInfo(i, primitives[i].WorldBound()); } // Build BVH tree for primitives using _primitiveInfo_ int totalNodes = 0; List <Primitive> orderedPrims = new List <Primitive>(primitives.Count); BVHBuildNode root; if (splitMethod == SplitMethod.HLBVH) { root = HLBVHBuild(primitiveInfo, out totalNodes, orderedPrims); } else { root = RecursiveBuild(primitiveInfo, 0, primitives.Count, ref totalNodes, orderedPrims); } primitives = orderedPrims; //primitiveInfo.resize(0); //LOG(INFO) << StringPrintf("BVH created with %d nodes for %d primitives (%.2f MB), arena allocated %.2f MB", //totalNodes, (int)primitives.size(), //float(totalNodes * sizeof(LinearBVHNode)) / // (1024.f * 1024.f), //float(arena.TotalAllocated()) / // (1024.f * 1024.f)); // Compute representation of depth-first traversal of BVH tree //treeBytes += totalNodes * sizeof(LinearBVHNode) + sizeof(*this) + // primitives.size() * sizeof(primitives[0]); //nodes = new List<LinearBVHNode>(totalNodes); int offset = 0; flattenBVHTree(root, ref offset); //CHECK_EQ(totalNodes, offset); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (FileId != null) { hashCode = hashCode * 59 + FileId.GetHashCode(); } hashCode = hashCode * 59 + SplitMethod.GetHashCode(); hashCode = hashCode * 59 + SplitValue.GetHashCode(); hashCode = hashCode * 59 + ImmediateDownload.GetHashCode(); return(hashCode); } }
public virtual void Read(PackFileDeserializer des, BinaryReaderEx br) { m_simplificationOptions = (SplitAndGenerateOptions)br.ReadByte(); m_splitMethod = (SplitMethod)br.ReadByte(); m_generateClusterGraphs = br.ReadBoolean(); br.ReadByte(); m_desiredFacesPerCluster = br.ReadInt32(); br.ReadUInt64(); br.ReadUInt64(); m_borderPreserveShrinkSize = br.ReadSingle(); m_streamingEdgeMatchTolerance = br.ReadSingle(); m_numX = br.ReadInt32(); m_numY = br.ReadInt32(); m_maxSplits = br.ReadInt32(); m_desiredTrisPerChunk = br.ReadInt32(); br.ReadUInt64(); br.ReadUInt64(); }
public void CopyFrom(tk2dSpriteSheetSource src) { texture = src.texture; tilesX = src.tilesX; tilesY = src.tilesY; numTiles = src.numTiles; anchor = src.anchor; pad = src.pad; scale = src.scale; colliderType = src.colliderType; version = src.version; active = src.active; tileWidth = src.tileWidth; tileHeight = src.tileHeight; tileSpacingX = src.tileSpacingX; tileSpacingY = src.tileSpacingY; tileMarginX = src.tileMarginX; tileMarginY = src.tileMarginY; splitMethod = src.splitMethod; }
/// <summary> /// Creates a new TIN object from the specified grid. /// </summary> /// <param name="Grid">The grid to be used to create the new TIN.</param> /// <param name="Deviation">If the distance between the grid elevation and the triangle surface elevation at any given /// point is greater than this value, the triangle will be split at this location. This value is in projected map coordinates.</param> /// <param name="SplitTest">The method to use when splitting triangles.</param> /// <param name="STParam">Split Test Parameter. This value depends on the SplitMethod specified. It will either be the /// smallest inscribed radius allowed measured in projected map coordinates, or it will be the /// smallest angle allowed measured in degrees.</param> /// <param name="MeshDivisions">This is the number of dividers used to create an initial mesh for the algorithm. Each cell in /// the initial mesh is subdivided into smaller triangles depending on the deviation within the cell. </param> /// <param name="MaximumTriangles">Optional. The maximum number of triangles allowed in the TIN. The default value is 1073741824. </param> /// <param name="cBack">Optional. The ICallback object which will receive progress and error messages while the TIN is being created.</param> /// <returns>A boolean value representing the success or failure of creating the new TIN.</returns> public bool CreateNew(Grid Grid, double Deviation, SplitMethod SplitTest, double STParam, int MeshDivisions, int MaximumTriangles, ICallback cBack) { throw new NotImplementedException(); }
public void CopyFrom(tk2dSpriteSheetSource src) { this.texture = src.texture; this.tilesX = src.tilesX; this.tilesY = src.tilesY; this.numTiles = src.numTiles; this.anchor = src.anchor; this.pad = src.pad; this.scale = src.scale; this.colliderType = src.colliderType; this.version = src.version; this.active = src.active; this.tileWidth = src.tileWidth; this.tileHeight = src.tileHeight; this.tileSpacingX = src.tileSpacingX; this.tileSpacingY = src.tileSpacingY; this.tileMarginX = src.tileMarginX; this.tileMarginY = src.tileMarginY; this.splitMethod = src.splitMethod; }