示例#1
0
 public int AddBufferView(gltf_BufferView newBufferView)
 {
     for (int i = 0; i < bufferViews.Count; i++)
     {
         if (bufferViews[i].IsSameAs(newBufferView))
         {
             return(i);
         }
     }
     bufferViews.Add(newBufferView);
     return(bufferViews.Count - 1);
 }
示例#2
0
 public bool IsSameAs(gltf_BufferView otherBuffer)
 {
     return(this.buffer == otherBuffer.buffer && this.byteLength == otherBuffer.byteLength && this.byteOffset == otherBuffer.byteOffset &&
            this.byteStride == otherBuffer.byteStride && this.target == otherBuffer.target);
 }
示例#3
0
        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);
                }
            }
        }