Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: various HMP related MDL7 SDK questions [Re: HeelX] #389625
12/16/11 13:23
12/16/11 13:23
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
10) I was able to successfully embed DDS and 8888 BMAP's as interal skins. But I have trouble with files I loaded via bmap_create, which were saved as 24bit images. As I found this out, I also was not able to store 24bit images correctly in my HMP. If a BMAP has a 8888 format and bytespp is = 3, do I have to make a stripped copy of the byte* pixels array, while I skip every fourth values (=alpha) and pass this array to SkinBits instead of just b->pixels???

Last edited by HeelX; 12/16/11 13:24.
Re: various HMP related MDL7 SDK questions [Re: HeelX] #389631
12/16/11 13:36
12/16/11 13:36
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
As to the mipmaps, there's an engine function to calculate them, but of course it's faster when they are already stored in the HMP file. They also have better quality dependent on the filter that you use.

The image in the HMP file is stored in straight 888 format. Only when it's loaded in your video hardware, it gets a different format such as 8888.

As to the questions 1) and 5), I've forwarded them to the developer, who will answer them when he's back next week.

Re: various HMP related MDL7 SDK questions [Re: jcl] #389641
12/16/11 14:13
12/16/11 14:13
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Thanks!

I found out, that I just have to correct the skin type and bytespp values, which I pass to .Skin and .SkinSize in the case that format is 8888 and bytespp is 3 -- I can always use the .pixels pointer.

[EDIT] Just for the record: if I create a bitmap during runtime and it is 8888, I can simply use finalbits (after locking) and if the size of the bmap is power of two; if it is 888 I have to do the stripping method I mentioned above (create array of 75% size and copy all contents from finalbits except every fourth element).

Last edited by HeelX; 12/16/11 15:18.
Re: various HMP related MDL7 SDK questions [Re: HeelX] #389840
12/18/11 23:11
12/18/11 23:11
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hm, when I set the mips flag of .SkinSize to true and pass pixels like I am doing for the main texture (the mip textures are each 1/2 the size of the previous texture...), I can't load the terrain in MED and when I load it as entity in the engine, it is unbelievable stretched on the z-axis...? smile

[EDIT]

Tested it twice: once with generated textures and once with provided textures... no success, though tired

Last edited by HeelX; 12/18/11 23:13.
Re: various HMP related MDL7 SDK questions [Re: HeelX] #389884
12/19/11 14:04
12/19/11 14:04
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
If you upload that terrain, I can check what it wrong.

Here's the remaining info - I'll also add this to the documentation:

HMP5_HEADER::flags determines whether the terrain is a floor or a cave ceiling, i.e. if the normals point upwards or downwards.

And the M7SKINTYP_RGBFLAG differentiates between RGB and BGR bit order on 24 and 32 bit skin types.

Re: various HMP related MDL7 SDK questions [Re: jcl] #389986
12/20/11 20:31
12/20/11 20:31
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Thank you!

Originally Posted By: jcl
If you upload that terrain, I can check what it wrong.


Yes, I will; tomorrow. A question in the meantime:


11) If terrain_chunk == 0 (terrains are'nt chunked): when is a terrain going to be valid? There are different information in the manual:
  • 'Entities' page: "Unchunked terrain is rendered just like a model, and must not exceed a size of 128x128 vertices." ... so, does this mean if it exceeds 16384 vertices or if either the x- or y- row/column vertices is greater than 128, the terrain cannot be unchunked? Like 130x128 or 128x130.
  • 'terrain_chunk' page: "Depending on the 3D hardware, the size of nonchunked terrain is normally limited to 65536 vertices" - do you really mean vertices or faces? So, if my total of vertices is greater than 65536, the terrain cannot be unchunked?
  • 'Updating' page: "Unchunked Terrain is not supported anymore. The Free and Extra versions also support chunked terrain." - so is every terrain chunked??? What happens if terrain_chunk is == 0 then???


Re: various HMP related MDL7 SDK questions [Re: HeelX] #390016
12/21/11 14:33
12/21/11 14:33
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Yes, every terrain is chunked in A8. Unchunked terrain is not supported anymore and terrain_chunk must not be 0.

Re: various HMP related MDL7 SDK questions [Re: jcl] #390018
12/21/11 15:00
12/21/11 15:00
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Ok! Then, maybe, you should clean up the statements about unchunked terrain in the manual - I guess it could be somehow confusing for beginners if they come across that stuff the first time.

Here is, by the way, the archive with the promised hmp's: http://www.christian-behrenberg.de/files/shared/a8/bugs/mips.rar

It contains two HMPs and 4 textures. The file "tile_mips_static.hmp" was created by loading the 4 bmps and using them as mipmap data sources; the file "tile_mips_dynamic.hmp" was created by creating consecutive smaller bitmaps from the passed internal BMAP*.

In both cases, "true" is passed for the mips parameter in .SkinSize(...) and BYTE* pointers are passed for the three mipmaps in .SkinBits(...).

For BMAP*'s, I wrote a function, that returns me a BYTE* pointer to the pixeldata. Here is the source:

Code:
BYTE* pixelsForBmap (BMAP* b, BOOL* locked, BYTE** stripped)
{
    BYTE* pixels = NULL;

    if (b && locked && stripped)
    {
        // if bmap was loaded from file, just take the (original) pixels
        if (b->pixels)
            pixels = b->pixels;
        else
        {
            // bmap was created during runtime, therefore no
            // "original" pixels are available

            // we need to lock image to access finalbits!

            bmap_lock(b, 0);
            *locked = true;

            // in the case of an 8888 image (BGRA), we can simply take
            // the finalbits

            if (b->bytespp == 4)
                pixels = (BYTE*)(b->finalbits);
            else
            {
                // problem: 24bit image is specified, but is stored internally
                // different. We have to extract the stuff!

                int n = b->width * b->height * 3;
                *stripped = (BYTE*)sys_malloc(sizeof(BYTE) * n);

                for (int i = 0; i < n; i++)
                    (*stripped)[i] = ((BYTE*)(b->finalbits))[((i / 3) * 4) + (i % 3)];

                pixels = (*stripped);
            }
        }
    }

    return(pixels);
}



The function behaviour is pretty selfexplanatory. If I create a stripped representation of the pixel data, the pointer references are set, so that I can handle such things in my circumstancing code, e.g. for cleanup or the like.

I use this function not only for mipmap BMAP's, but also for the main skin image. If mips is == false and therefore I pass NULL, NULL, NULL as mipmaps to SkinBits, everything is fine and the terrain can be loaded in MED and in the engine... --- So this is the reason why I did two test: because if my internal mipmap calculation is somehow broken, my passed BMAP's, loaded from file, must be correct, because the sizes are right and the function is proofed to be correct (on the main image before).

I hope these information are sufficient for you to find out what is going wrong here on my end smile and thank you very much for your time!!

Re: various HMP related MDL7 SDK questions [Re: HeelX] #391443
01/12/12 08:15
01/12/12 08:15
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hi,
have you found the reason for my problems?

By the way, I now turned to loading hmp's from files. There is a code segment in the LoadHMP.cpp example file, which is executed in a case, which I don't understand:

Code:
int numv_x = (int) head->fnumverts_x;
int numv_y = head->numverts / numv_x;

...

float x_size = head->ftrisize_x * (numv_x - 1);
float y_size = head->ftrisize_y * (numv_y - 1); 
float x_step = x_size / (numv_x-1); 
float y_step = y_size / (numv_y-1); 

...

//'hmp.fr' == current frame data
if ( x_step == 0 || y_step == 0)
{
    float min_x = (float) hmp.fr->min.p_pos[0] * head->scale[0] + head->scale_origin[0];
    float min_y = (float) hmp.fr->min.p_pos[1] * head->scale[1] + head->scale_origin[1];
    
    float max_x = (float) hmp.fr->max.p_pos[0] * head->scale[0] + head->scale_origin[0];
    float max_y = (float) hmp.fr->max.p_pos[1] * head->scale[1] + head->scale_origin[1];
    
    x_size = (max_x-min_x);
    y_size = (max_y-min_y); 
    x_step = x_size / (numv_x - 1);
    y_step = y_size / (numv_y - 1);
}



The if-block is executed if and only if the header indicates no triangle size for x or y direction - but when is that the case? Is this code segment just a workaround for hmp files which were written in a wrong way by a user? Is it possible that the MDL7 SDK can do this also?

Re: various HMP related MDL7 SDK questions [Re: HeelX] #391494
01/13/12 11:17
01/13/12 11:17
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I think this is just for catching wrong input data, such as terrain that only consists of 1 vertex. - I'll check your example in the next time.

Page 2 of 2 1 2

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1