public override void Load(Utility utility) { base.Load(utility); Height = utility.ReadU32(); Width = utility.ReadU32(); // These are Ohana3DS names, I don't know if this is really what these are?? // (And even if they are, not sure how they map to OpenGL exactly) OpenGLFormat = utility.ReadU32(); OpenGLType = utility.ReadU32(); MipmapLevels = utility.ReadU32(); // NOTE: Unsure of the exact implication of multiple mipmap levels in terms of data. // It seems like this wasn't properly supported by "old" Ohana3DS, so I'd like to know... if (MipmapLevels > 1) { throw new NotImplementedException($"ChunkDICTTexture Load: More than 1 mipmap level ({MipmapLevels}); need to investigate if that means more texture data or what..."); } // Once again, Ohana3DS names, not sure what they are or if I should support them TextureObject = utility.ReadU32(); LocationFlags = utility.ReadU32(); if (TextureObject != 0) { // Note to self, if I get here... this may be non-fatal, I'm more worried if it's pointing to data throw new NotImplementedException(); } TextureFormat = (Format)utility.ReadU32(); // Not even Ohana3DS tried to address these! Unknown1 = utility.ReadU32(); Unknown2 = utility.ReadU32(); Unknown3 = utility.ReadU32(); // Texture will be stored as raw blob rather than as length/offset values var dataLength = utility.ReadU32(); var dataOffset = utility.ReadOffset(); CGFXDebug.WriteLog($"NOTE: TextureCGFXData of format {TextureFormat} starts at {dataOffset.ToString("X4")}"); utility.PushReadPosition(); utility.SetReadPosition(dataOffset); TextureCGFXData = utility.ReadBytes(dataLength); utility.PopReadPosition(); DynamicAllocator = utility.ReadU32(); BitsPerPixel = utility.ReadU32(); LocationAddress = utility.ReadU32(); MemoryAddress = utility.ReadU32(); //var testRGBA = TextureCodec.ConvertTextureToRGBA(utility, TextureCGFXData, TextureFormat, Width, Height); //var textCGFX = TextureCodec.ConvertTextureToCGFX(utility, testRGBA, TextureFormat, Width, Height); }
protected override void LoadInternal(Utility utility) { BufferObject = utility.ReadU32(); LocationFlag = utility.ReadU32(); // The RawBuffer contains ??? CGFXDebug.WriteLog($"NOTE: RawBuffer read in VertexBufferInterleaved, see next address of List"); RawBuffer = utility.LoadIndirectValueList(() => utility.ReadByte()); LocationPtr = utility.ReadU32(); MemoryArea = utility.ReadU32(); VertexStride = utility.ReadI32(); Attributes = utility.LoadIndirectObjList(() => Load <VertexAttribute>(utility)).ToList(); }
protected override void LoadInternal(Utility utility) { BufferObject = utility.ReadU32(); LocationFlag = utility.ReadU32(); // The RawBuffer contains either 16-bit int or floating point values // for a Vector4, depending on "Format"; see GetVectors() for more... CGFXDebug.WriteLog($"NOTE: RawBuffer read in VertexAttribute, see next address of List"); RawBuffer = utility.LoadIndirectValueList(() => utility.ReadByte()); LocationPtr = utility.ReadU32(); MemoryArea = utility.ReadU32(); Format = (GLDataType)utility.ReadU32(); Elements = utility.ReadI32(); Scale = utility.ReadFloat(); Offset = utility.ReadI32(); }