public int AddBuffer(gltf_Buffer newBuffer) { for (int i = 0; i < buffers.Count; i++) { if (buffers[i].datahash == newBuffer.datahash) { return(i); } } buffers.Add(newBuffer); return(buffers.Count - 1); }
public gltf_Accessors(UInt32 bufferViewIndex, UInt32 ComponentType, string AccessorType, gltf_BufferView bufferView, gltf_Buffer buffer) { UInt32 varsize = gltf_AccessorTypes.size(AccessorType); this.bufferView = bufferViewIndex; this.componentType = ComponentType; this.byteOffset = 0; this.count = Convert.ToUInt32(buffer.byteLength / (gltf_ComponentSizes.size(ComponentType) * varsize)); this.type = AccessorType; if (ComponentType == gltf_ComponentTypes.Float) { if (varsize == 3 || varsize == 1) { this.min = new FloatUInt32(buffer.fmin); this.max = new FloatUInt32(buffer.fmax); } else { this.min = new FloatUInt32(Convert.ToInt32(varsize), false, false, true); this.min = new FloatUInt32(Convert.ToInt32(varsize), false, true, false); } } else { if (varsize == 1) { this.min = new FloatUInt32(buffer.uimin); this.max = new FloatUInt32(buffer.uimax); } else { this.min = new FloatUInt32(Convert.ToInt32(varsize), true, false, true); this.min = new FloatUInt32(Convert.ToInt32(varsize), true, true, false); } } }