Author Topic: There are many ways to go to Rome.  (Read 82726 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #75 on: March 22, 2019, 03:54:36 pm »
No, the X,Y coordinates computation is wrong, see the red dots on the attached screen shot

Here is the code i am using to compute the X,Y dot location based on your suggestion.


void CreatePointArray(IN long selected) { // 03-20-2019
    MobjMesh* pMesh = &gtm_meshes[selected];
    long* index = &gnm_indexBuffer[pMesh->startIndex];
    long vertsTotal = pMesh->triangleCount * 3;

    long x = 0, y = 0, w = 0, h = 0, nW = 0, nH = 0, newID = 0, nIDtoClone = 0, nSpriteCount = 0;

    ZI_GetImageSizeFromControl(gT.hZoomCtrl, nW, nH);

    WCHAR zMarker[MAX_PATH] = { 0 };
    Path_Combine(zMarker, MarkerPath(), L"dot_8.png");
    HBITMAP hBitmap = ZI_CreateBitmapFromFile(zMarker, w, h);
    long nCount = w / h; if ((nCount * h) != w) { nCount = 1; } else { w = h; }
    w /= 2;
    h /= 2;


    WCHAR zAf[64] = { 0 };
       
    for (int j = 0; j < vertsTotal; j++, index++) {
        MobjVertexT* vertex = &gtm_vertexBuffer[gnm_indexBuffer[*index]];

        x = (long) (nW * fmod(vertex->texCoord[0], 1.0f)) - w; // OpenGL tex coords may be a multiple of 1.0f if GL_REPEATed
        y = (long) (nH * (1.0f - fmod(vertex->texCoord[1], 1.0f))) - h; // ditto

        StringCchPrintf(zAf, strSize(zAf), L"x = %2d, y = %2d", x, y);
        zTrace(zAf);

        newID = IncrID(); // Increment ID and ga_Sprite array
        if (nIDtoClone) { // Clone the dot object (the same bitmap is used by all the hot spots)
            CloneObject(newID, $NULL, x, y, nIDtoClone);
            // Comme c'est un clone, il faut réinitialiser les propriétés de l'objet GDImage.
            ZD_SetObjectRotation(newID, 0);
            ZD_SetObjectFlipMode(newID, 0);
            ZD_SetObjectAngle(newID, 0, 0);
            ZD_SetObjectScale(newID, 0);
            ZD_SetObjectAlpha(newID, 255, FALSE);
            ZD_SetObjectFlipMode(newID, ZD_GetObjectFlipMode(newID));
            ZD_SetObjectVisibility(newID, ZS_VISIBLE);
        } else {                 // We must use this bitmap.
            ZD_DrawBitmapToCtrl(gT.hZoomCtrl, x, y, hBitmap, ZD_ColorARGB(255, 0), newID, ZS_VISIBLE);
            nIDtoClone = newID;
        }
        if (nCount > 1) {
            ZD_SetObjectFrameCount(newID, (BYTE) nCount); // <---- Sprite multi-state.
            ZD_SetObjectFrameToUse(newID, 1, FALSE);
        }
        ZD_SetObjectScroll(newID, TRUE);
        ZD_SetObjectQuality(newID, gT.UseQuality, FALSE);
        SpriteArrayInit(newID, zMarker);     // Initialize the global Sprite array
    }
    ZI_UpdateWindow(gT.hZoomCtrl, FALSE);
}
« Last Edit: March 22, 2019, 04:04:38 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #76 on: March 22, 2019, 03:55:06 pm »
No, the wireframe UVs aren't correct because 1.0f * 256 should yield 256 and not 0 which is due to fmod. Please remove the fmod() call. It should be omitted in the simplest case or replaced with if (vertex->texCoord[0|1] > 1.0f) etc. in GL_REPEAT cases (which might even be faster than fmod BTW...)
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #77 on: March 22, 2019, 04:02:38 pm »
Patrice,

These ARE NOT bullet coords! These are wireframe triangle coords! Do not use them for bullets but only for the PolyPolygon() call!

The bullet array will be different; there will be only 9 UVs/bullets/sprites in it -- exactly how many distinct vertices there are in the model (actually, mesh)!
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #78 on: March 22, 2019, 04:45:26 pm »
So far all i want is the good algo to compute the correct DOT x,y location.
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #79 on: March 22, 2019, 04:55:21 pm »
If by DOT you mean a bullet/sprite/whatever-you-call-those-red-circles-in-your-snapshots, then let me tell you that it WILL NOT help you draw the wireframe over the texture map. ;)

Those are two distinct problems, and wireframe is the easiest of the two. Let's do first things first. I've given you all the details how to implement it. Now just do it, please.
« Last Edit: March 22, 2019, 04:59:09 pm by Michael Lobko-Lobanovsky »
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #80 on: March 22, 2019, 07:09:58 pm »
In the .obj file the texture coordinates are stored like this:

vt 0 0 0
vt 0 0.5 0
vt 0.5 0.5 0
vt 0.5 0 0
vt 1 0 0
vt 0 1 0
vt 0.5 1 0
vt 1 1 0
vt 1 0.5 0
# 9 texture coordinates

            case 't': // vt
                fscanf(pFile, "%f %f",
                    &grm_textureCoords[2 * numTexCoords],
                    &grm_textureCoords[2 * numTexCoords + 1]);
                ++numTexCoords;
                break;

This is exactly what i am looking for, to display my hot spots.
« Last Edit: March 22, 2019, 07:17:37 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #81 on: March 22, 2019, 08:30:42 pm »
I have been able to display the hot spots, however it encompasses the internal GDImage maximum capacity, thus i have to think to another solution (perhaps point in triangle).
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #82 on: March 22, 2019, 08:41:42 pm »
Quote
This is exactly what i am looking for, to display my hot spots.

This is just your lucky chance, your very special case! :D

But where are they stored this way among the many meshes in your process memory in a general case -- after two rounds of Mobj_importGeometry? Especially if you're through with yet a hundred more rounds of editing your geometry and thus cannot simply read them up from the old .OBJ file... ;)

That is the question! (c) W.Shakespeare ;D
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #83 on: March 22, 2019, 08:46:55 pm »
I have been able to display the hot spots, however it encompasses the internal GDImage maximum capacity, thus i have to think to another solution (perhaps point in triangle).

Remember we're just exploring the limits of Tor. If it fails, we will simply revert to my Xandreale GDI code that can cope simultaneously with at least 30,000 UVs per mesh! (I just don't have .XAN models with larger meshes because they all come from a real console game we cracked with another French friend of mine about a decade ago)
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #84 on: March 22, 2019, 09:16:20 pm »
Quote
Remember we're just exploring the limits of Tor. If it fails, we will simply revert to my Xandreale GDI code that can cope simultaneously with at least 30,000 UVs per mesh

Perhaps we can use your Xandreale code to create the transparent bitmap overlay, and use it within the zoom control ?


Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #85 on: March 22, 2019, 09:24:03 pm »
... the transparent bitmap overlay ...

What exactly do you mean by this term? Please describe its content and function within Tor.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #86 on: March 22, 2019, 09:34:17 pm »
See the attached video.

Do you have a video or a working example of what your Xandreale code does ?
Is it able to produce 32-bit bitmap (with alpha channel) ?
« Last Edit: March 22, 2019, 09:48:36 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #87 on: March 22, 2019, 10:05:55 pm »
See the attached video.

Now I see, thank you.

Quote
Is it able to produce 32-bit bitmap (with alpha channel) ?

My Xandreale GDI code draws into the backbuffer where the texture image has first been drawn as the background. The entire backbuffer is then blitted on screen as necessary.

There's currently nothing to drag around or show the video of. 32-bit color transparency is not supported because it is unnecessary for the above technique. Neither is it available in the 24-bit GDI context at all.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #88 on: March 22, 2019, 10:22:18 pm »
Here's what I have. It's rough but it can can give you a general idea. The texture image is zoomable and so are the flat 1 px wide yellow wireframe/3x3 px cyan UV boxes.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #89 on: March 22, 2019, 11:09:19 pm »
Thank you for the video, great piece of work, congratulation!





Patrice
(Always working with the latest Windows version available...)