Hi there,
I'm busy with handeling content ( textures, meshes, etc).
I'd like to stream data to a binary file and then when I need them I just read everything from the binary file.
The problem is: I can stream everything from custom made classes to basic variables like integers etc, but when I try t read a COM object it just won't work.
this is what my writer looks like:
ContentTypeWriter& ContentTypeWriter::operator<<(ID3D11ShaderResourceView** resource)
{
Write(&resource, sizeof(ID3D11ShaderResourceView));
return *this;
}
void ContentTypeWriter::Write(const void* buffer, size_t length)
{
m_Stream->write((char*)buffer, length);
if (!*m_Stream)
Logger::Log(_T("File::write Error"), LOGTYPE_ERROR, false);
}
this is what my reader looks like:
ContentTypeReader& ContentTypeReader::operator>>(ID3D11ShaderResourceView** resource)
{
Read(&resource, sizeof(ID3D11ShaderResourceView));
return *this;
}
void ContentTypeReader::Read(void* buffer, size_t length)
{
m_Stream->read((char*)buffer, length);
if (!*m_Stream)
Logger::Log(_T("File::write Error"), LOGTYPE_ERROR, false);
}
Everytime I load my ShaderResourceView it comes out as a 0x000000, but all my other variables are parsed the same way and they come out just like I saved them.
Does anybody have any idea what I'm doing wrong?