Fix cubemap face offset calculation
| | |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | continue; |
| | | } |
| | |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getCubeFace(cubeFace, miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getCubeFace(cubeFace, miplevel, glfmt, tex, cubemapfacelen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | continue; |
| | | } |
| | |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | printf("MOJODDS_getMipMapTexture(%u) error: %d\n", miplevel, retval); |
| | | continue; |
| | |
| | | |
| | | case MOJODDS_TEXTURE_CUBE: |
| | | printf("cube\n"); |
| | | printf("cubemapfacelen: %u\n", cubemapfacelen); |
| | | printf("\n"); |
| | | |
| | | for (unsigned int miplevel = 0; miplevel < miplevels; miplevel++) { |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getCubeFace(MOJODDS_CUBEFACE_POSITIVE_X, miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getCubeFace(MOJODDS_CUBEFACE_POSITIVE_X, miplevel, glfmt, tex, cubemapfacelen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | printf("MOJODDS_getMipMapTexture(%u) error: %d\n", miplevel, retval); |
| | | continue; |
| | |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | printf("MOJODDS_getMipMapTexture(%u) error: %d\n", miplevel, retval); |
| | | continue; |
| | |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getMipMapTexture(miplevel, glfmt, tex, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | printf("MOJODDS_getMipMapTexture(%u) error: %d\n", miplevel, retval); |
| | | continue; |
| | |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getCubeFace(cubeFace, miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getCubeFace(cubeFace, miplevel, glfmt, tex, cubemapfacelen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | printf("MOJODDS_getCubeFace(%u, %u) error: %d\n", cubeFace, miplevel, retval); |
| | | continue; |
| | |
| | | const void *miptex = NULL; |
| | | unsigned long miptexlen = 0; |
| | | unsigned int mipW = 0, mipH = 0; |
| | | retval = MOJODDS_getCubeFace(cubeFace, miplevel, glfmt, tex, texlen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | retval = MOJODDS_getCubeFace(cubeFace, miplevel, glfmt, tex, cubemapfacelen, w, h, &miptex, &miptexlen, &mipW, &mipH); |
| | | if (!retval) { |
| | | printf("MOJODDS_getCubeFace(%u, %u) error: %d\n", cubeFace, miplevel, retval); |
| | | continue; |
| | |
| | | } // MOJODDS_getTexture |
| | | |
| | | int MOJODDS_getMipMapTexture(unsigned int miplevel, unsigned int glfmt, |
| | | const void*_basetex, const unsigned long _basetexlen, |
| | | const void*_basetex, |
| | | unsigned int w, unsigned h, |
| | | const void **_tex, unsigned long *_texlen, |
| | | unsigned int *_texw, unsigned int *_texh) |
| | |
| | | |
| | | int MOJODDS_getCubeFace(MOJODDS_cubeFace cubeFace, unsigned int miplevel, |
| | | unsigned int glfmt, const void *_basetex, |
| | | unsigned long _basetexlen, unsigned int w, unsigned h, |
| | | unsigned long _cubemapfacelen, unsigned int w, unsigned h, |
| | | const void **_tex, unsigned long *_texlen, |
| | | unsigned int *_texw, unsigned int *_texh) |
| | | { |
| | | // pick correct face |
| | | const char *faceBaseTex = (const char *) _basetex; |
| | | faceBaseTex = faceBaseTex + cubeFace * _basetexlen; |
| | | faceBaseTex = faceBaseTex + cubeFace * _cubemapfacelen; |
| | | |
| | | |
| | | // call MOJODDS_getMipMapTexture to get offset in that face |
| | | return MOJODDS_getMipMapTexture(miplevel, glfmt, faceBaseTex, _basetexlen, w, h, _tex, _texlen, _texw, _texh); |
| | | return MOJODDS_getMipMapTexture(miplevel, glfmt, faceBaseTex, w, h, _tex, _texlen, _texw, _texh); |
| | | } |
| | | |
| | | |
| | |
| | | unsigned int *_cubemapfacelen, |
| | | MOJODDS_textureType *_textureType); |
| | | int MOJODDS_getMipMapTexture(unsigned int miplevel, unsigned int glfmt, |
| | | const void*_basetex, const unsigned long _basetexlen, |
| | | const void*_basetex, |
| | | unsigned int w, unsigned h, |
| | | const void **_tex, unsigned long *_texlen, |
| | | unsigned int *_texw, unsigned int *_texh); |
| | | |
| | | int MOJODDS_getCubeFace(MOJODDS_cubeFace cubeFace, unsigned int miplevel, |
| | | unsigned int glfmt, const void*_basetex, |
| | | unsigned long _basetexlen, unsigned int w, unsigned h, |
| | | unsigned long _cubemapfacelen, unsigned int w, unsigned h, |
| | | const void **_tex, unsigned long *_texlen, |
| | | unsigned int *_texw, unsigned int *_texh); |
| | | |