diff --git a/docs/rendering/MDL_FILES.md b/docs/rendering/MDL_FILES.md new file mode 100644 index 0000000..57b90ff --- /dev/null +++ b/docs/rendering/MDL_FILES.md @@ -0,0 +1,104 @@ +# MDL Files +These seem to be simple model files containing the required information to render 3D objects. +They're also used in some 2D backgrounds (like 2879436369) for bones. + +**NOTE**: This documentation page is not completed yet as there's still work left to do on the reverse engineering of this file format. For now just a structure, describing the file format is here + +``` +// +// 010 editor template +// +// +typedef struct { + float x ; + float y ; + float z ; +} VECTOR3; + +typedef struct { + float x ; + float y ; + float z ; + float w ; +} VECTOR4; + +typedef struct { + float x ; + float y ; +} VECTOR2; + +typedef struct { + DWORD x ; + DWORD y ; + DWORD z ; + DWORD w ; +} BLENDINDICES; + +typedef struct { + VECTOR3 vertex ; + BLENDINDICES blendindices; + VECTOR4 blendweight; + VECTOR2 uv ; +} VERTEX; + +typedef struct { + WORD x; + WORD y; + WORD z; +} VERTEXINDICE; + +typedef struct { + CHAR header[]; + DWORD first; + DWORD second; + DWORD third; + CHAR json[]; + DWORD fourth; + DWORD fifth; + DWORD vertexByteLength; + VERTEX vertices[vertexByteLength / sizeof(VERTEX)]; + DWORD indicesByteLength; + VERTEXINDICE indices[indicesByteLength / sizeof (VERTEXINDICE)] ; +} MDLVHEADER; + +typedef struct { + BYTE tmp; + DWORD type; + DWORD unk1; +} BONEENTRYHEADER; + +typedef struct { + BONEENTRYHEADER header; + DWORD entryByteLength; + float v[entryByteLength / sizeof (float)]; + CHAR info[]; +} BONEENTRY; + +typedef struct { + BONEENTRYHEADER header; +} BONE2ENTRY; + +typedef struct { + CHAR header[]; + DWORD mightBeByteLength; + DWORD numberOfBones; + BONEENTRY bones[numberOfBones]; + BONE2ENTRY unk[numberOfBones]; +} MDLSHEADER; + +typedef struct { + CHAR header[]; +} MDLAHEADER; + +typedef struct { + MDLVHEADER mdlv; + MDLSHEADER mdls; +} MDLFILE; + +LittleEndian (); +MDLFILE file; + +// mdlv => vertices information +// mdls => skinning information +// mdla => animation information +``` \ No newline at end of file diff --git a/src/WallpaperEngine/Render/Objects/CImage.cpp b/src/WallpaperEngine/Render/Objects/CImage.cpp index 132c5e0..333f7ae 100644 --- a/src/WallpaperEngine/Render/Objects/CImage.cpp +++ b/src/WallpaperEngine/Render/Objects/CImage.cpp @@ -269,11 +269,6 @@ void CImage::simpleRender () { ITexture* input = this->m_mainFBO; - // clear the main framebuffer - glBindFramebuffer (GL_FRAMEBUFFER, this->m_mainFBO->getFramebuffer ()); - // attach the main texture - glClear (GL_COLOR_BUFFER_BIT); - // FIXME: THIS IS A QUICK HACK FOR ANIMATED IMAGES, IF ANY OF THOSE HAVE ANY EFFECT ON THEM THIS WILL LIKELY BREAK if (this->getTexture ()->isAnimated () == true) { @@ -303,11 +298,6 @@ void CImage::complexRender () CFBO* drawTo = this->m_mainFBO; ITexture* asInput = this->getTexture (); - // clear the main framebuffer - glBindFramebuffer (GL_FRAMEBUFFER, this->m_mainFBO->getFramebuffer ()); - // attach the main texture - glClear (GL_COLOR_BUFFER_BIT); - // do the first pass render into the main framebuffer auto cur = this->m_copyMaterial->getPasses ().begin (); auto end = this->m_copyMaterial->getPasses ().end (); @@ -389,6 +379,11 @@ void CImage::render () glColorMask (true, true, true, true); + // clear the main framebuffer + glBindFramebuffer (GL_FRAMEBUFFER, this->m_mainFBO->getFramebuffer ()); + // attach the main texture + glClear (GL_COLOR_BUFFER_BIT); + // check if there's more than one pass and do different things based on that if (this->m_effects.empty () == true) this->simpleRender ();