Author Topic: Early WIP on v2.55  (Read 178970 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: Early WIP on v2.55
« Reply #195 on: November 15, 2018, 09:34:30 pm »
Quote
Are you in fact teasing me with all those futuristic gadgets and constructs?
It is my way to teach you what could be done using GDImage memory compositing, with just a few lines of code.  8)

BTW, for the button color i prefer to keep the gray one, to stay in sync with the main skin theme.
« Last Edit: November 15, 2018, 09:39:43 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #196 on: November 15, 2018, 10:14:31 pm »
Re. "futuristic gadgets and constructs":

It is my way to teach you what could be done using GDImage memory compositing, with just a few lines of code.  8)

I'm well past 2D, my friend. You can only stir my feelings with your 3D content. ;)

But while we're at it, can you send me your französisch assets to try out? :)

Quote
BTW, for the button color i prefer to keep the gray one, to stay in sync with the main skin theme.

When something's popping up with a swoosh sound in your viewport, your attention is bound to concentrate on that something rather than on your main window decorations. ;)

I'm going to send you some of my toast window exercises soon.
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: Early WIP on v2.55
« Reply #197 on: November 15, 2018, 11:47:47 pm »
Here it is...

Thanks a lot, Patrice! But how do I make her sit on top of our toast window, please?

If you want to fade the Toast window, you can play with the ZI_SetLayeredAlpha(hWnd, Alpha) API. Using it when the timer has ellapsed the 10 seconds delay, while keeping the current moving down, for the case of the T_Close button.

Good idea Patrice, thank you! Will do in the next patch.

In the mean time, TA-DA-A-A !!! ... And as promised, here comes our brand new Popup Help System! :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: Early WIP on v2.55
« Reply #198 on: November 17, 2018, 03:44:36 pm »
Progress Status Update

Been working on the viewport tool tip (now called "mesh info tip") since morning. A regular WinLIFT tool tip isn't usable for this purpose because the mesh info tip has different logic and behavior.

I'm hoping to be ready to submit the patch this evening. Stay tuned! :)


(In the mean time, what about my question on sitting the französisch creature on top of the toast window?)
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: Early WIP on v2.55
« Reply #199 on: November 17, 2018, 04:22:00 pm »
We can create a custom one, based one the same concept than for the toast window, especially if we want to use fancy shape or multiline(s)...
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: Early WIP on v2.55
« Reply #200 on: November 17, 2018, 04:28:28 pm »
Quote
In the mean time, what about my question on sitting the französisch creature on top of the toast window
To use the Hajime Sorayama robot, just use the same API than for the T_Close button or the light bulb.

I shall create the bitmap for you, give me just a few minutes…

Added:
Here is the png file, now i shall write a quick code example to show you how to sit her on the top left corner...
« Last Edit: November 17, 2018, 04:40:50 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1992
    • zapsolution
Re: Early WIP on v2.55
« Reply #201 on: November 17, 2018, 06:15:43 pm »
Try with this (make first a copy of your ToastWindow)

Code: [Select]
void ToastWindow(IN WCHAR* UseIcon, IN WCHAR* UseCaption, IN WCHAR* UseComment) { //IN HWND hParent, IN HINSTANCE hInstance) {
    if (gP.hToast) { DestroyWindow(gP.hToast); }

    WCHAR zFont[MAX_PATH]; ClearMemory(zFont, sizeof(zFont));
    Path_Combine(zFont, skSkinFolder(), L"trebuc.ttf");

    // We compute the correct size
    long CommentW = 0, CommentH = 0;
    ZD_GetTextBound(UseComment, zFont, 14, CommentW, CommentH, ZD_TextHorzUp, FontStyleRegular); // We use horizontal orientation
    long UseW = CommentW + 4;
    long UseH = CommentH;
    long CaptionW = 0, CaptionH = 0;
    ZD_GetTextBound(UseCaption, zFont, 18, CaptionW, CaptionH, ZD_TextHorzUp, FontStyleRegular); // We use horizontal orientation
    UseW = max(UseW, CaptionW + 4);
    UseH += CaptionH;
    long bmW = 0, bmH = 0;
    HBITMAP hBitmap = ZI_CreateBitmapFromFile(UseIcon, bmW, bmH);
    long xOffset = 0, yOffset = 0;
    WCHAR zResource[MAX_PATH]; ClearMemory(zResource, sizeof(zResource));
    Path_Combine(zResource, skSkinFolder(), L"robot.png");
    if (FileExist(zResource)) {
        xOffset = 22, yOffset = 76;
    }

    UseW = xOffset + 4 + bmW + 4 + UseW + 4;
    UseH = yOffset + 4 + max(bmH, UseH) + 4 + 4;

    // Here we create the compositing array
    // Note: The z-order composition will match the array order, the lower indice at the bottom, the higher on top.
    const long nCount = 7;
    ZOBJECT arrayobj[nCount]; ClearMemory(&arrayobj[0], sizeof(arrayobj));

    if (xOffset) {
        long w = 0, h = 0;
        ZI_CreateBitmapObject(arrayobj[6], 0, 0, ZI_CreateBitmapFromFile(zResource, w, h), ZD_ARGB(255, 0, 0, 0), ZS_VISIBLE);
    }

    ZI_CreateBitmapObject(arrayobj[3], xOffset + 4, yOffset + 4, hBitmap, ZD_ARGB(255, 0, 0, 0), ZS_VISIBLE);
    ZI_CreateTextObject(arrayobj[4], UseCaption, xOffset + 4 + bmW + 4, yOffset + 4, CaptionW + 8, CaptionH + 8, ZD_ARGB(255, 255, 240, 140), zFont, 18, ZS_VISIBLE, 1, StringAlignmentNear, FontStyleRegular);
    ZI_CreateTextObject(arrayobj[5], UseComment, xOffset + 4 + bmW + 4, yOffset + 4 + CaptionH + 4, CommentW + 8, CommentH + 8, ZD_ARGB(255, 255, 213, 83), zFont, 14, ZS_VISIBLE, 1, StringAlignmentNear, FontStyleRegular);

    ZI_CreateRectangleObject(arrayobj[2], xOffset + 1, yOffset + 1, UseW - 3 - xOffset, UseH - 3 - yOffset, ZD_ARGB(255, 255, 240, 140), 1, ZS_VISIBLE | ZS_DRAFT, ZD_DRAW_OUTLINE, 0);
    ZI_CreateRectangleObject(arrayobj[1], xOffset + 0, yOffset + 0, UseW - xOffset, UseH - yOffset, ZD_ARGB(128, 128, 128, 128), 0, ZS_VISIBLE | ZS_DRAFT, ZD_DRAW_FILLED, 0);
    ZI_CreateRectangleObject(arrayobj[0], 0, 0, UseW, UseH, ZD_ARGB(0, 0, 0, 1), 0, ZS_HIDDEN | ZS_DRAFT, ZD_DRAW_FILLED, 0);

    WCHAR zFile[MAX_PATH]; ClearMemory(zFile, sizeof(zFile));
    Path_Combine(zFile, zGetTempPath(), L"zToast.png");
    //Path_Combine(zFile, EXEpath(), L"zToast.png");
    ZI_CreateImageComposited(zFile, UseW, UseH, arrayobj, nCount);

    RECT rw; GetWindowRect(gP.hGL, &rw);
    long x = rw.right - UseW;
    long y = rw.bottom - UseH;
    // This API requires the use of a file name, rather than a bitmap handle. It can create/use a region on the fly.
    HWND hWnd = ZI_CreateWindowFromImage(WS_POPUP, zFile, x, y, gP.hGL, 0, 0, 0);
    if (IsWindow(hWnd)) {
        ZI_DwmEnable(hWnd);
        WCHAR zResource[MAX_PATH]; ClearMemory(zResource, sizeof(zResource));
        Path_Combine(zResource, skSkinFolder(), L"T_Close.png");
        long w = 0, h = 0;
        hBitmap = ZI_CreateBitmapFromFile(zResource, w, h);
        x = UseW - w - 8; y = 8 + yOffset;
        long nID = ID_TOAST_HIDE;
        ZD_DrawBitmapToCtrl(hWnd, x, y, hBitmap, ZD_ColorARGB(255, 0), nID, ZS_VISIBLE);
        ZD_SetObjectLocked(nID, TRUE);
        //MonitorMessages(hWnd, (LONG_PTR) ToastCallBack);
        ZI_EventMessageEx(hWnd, (LONG_PTR)ToastCallBack, WM_LBUTTONUP, TRUE);
        gP.hToast = hWnd;
    }
    zKillFile(zFile);
}
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #202 on: November 17, 2018, 06:25:55 pm »
We can create a custom one, based one the same concept than for the toast window, especially if we want to use fancy shape or multiline(s)...

No, I prefer to keep it in your ordinary tool tip style. Either way, there's going to be the need to create a custom window and that's what's the easiest part of it.

What I'm doing now is debugging the shader and proc that are meant to render the scene to an invisible backbuffer to perform color coded mesh selection pass. That's similar to the Z-axis rotation hit test pass but coded in 24-bit color palette. It's supposed to render the entire model, and there may be dozens of thousands meshes there (like in those that you haven't yet optimized), and each one needs coding in its own unique color. Hence the need to use a shader rather than an ordinary draw list -- for speed reasons.

This takes time. I'm marking my mods conservatively with MLL 11-18-2018: but hopefully I'll be able to complete the task tonight. :)

I shall create the bitmap for you, give me just a few minutes…
Added:
Here is the png file, now i shall write a quick code example to show you how to sit her on the top left corner...

Try with this ...

Thanks for your time, my friend! :)
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: Early WIP on v2.55
« Reply #203 on: November 17, 2018, 06:29:06 pm »
Mike

Using drag & drop of an obj file, onto the desktop OR icon, doesn't work anymore  :-[
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #204 on: November 17, 2018, 06:41:21 pm »
For me, it works just fine when
-- dragging-and-dropping the OBJ file on the ObjReader.exe icon;
-- ditto, on the ObjReader desktop shortcut;
-- from the Windows menu Run... prompt;
-- from the console prompt with absolute pathnames to the EXE and OBJ files.

I've got no idea what might be wrong with your copy...  :-\

(The robot smears the viewport when sliding up into view but never mind, I've got the idea how to use it, thanks!)

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: Early WIP on v2.55
« Reply #205 on: November 17, 2018, 06:51:00 pm »
Ok, i found the problem, this occures when space characters are being used in the path name (or file name).
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #206 on: November 17, 2018, 10:25:26 pm »
Got it , thanks!
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: Early WIP on v2.55
« Reply #207 on: November 18, 2018, 02:38:03 am »
Quote
I do not agree with the way the wallpaper is now being resized (stretched), the original aspect is not preserved...
................................
Thank you!

Patrice,

Please pull your horses a little. :) (the red quotation in written English is usually an indication that the conversation is on the verge of becoming a scandal)

If you bother to find all the occurrences of glOrtho(-gP.glRatio, gP.glRatio, ...) pertaining to the wallpaper renders, you'll see that your aspect ratio is preserved throughout the sources as it always has been.

The problem is a direct consequence of your historically uncontrollable wallpaper texture rescaling/gl_wrapping havoc and voodoo in the pandora's formerly closed sources. Remember where

// MLL 02-28-2018: tex generation modes
//1 = Create square texture
//2 = Stretch to memory bitmap
//3 = Accept texture of any size
//4 = MipMapping
//0 or 1 is the same, for historical purpose(OpenGL 1.0 compatibility)
#define TEX_COMPAT  0
#define TEX_SQUARE  1
#define TEX_STRETCH 2
#define TEX_ANYSIZE 3 // clamped, not mipmapped
#define TEX_REPEAT  4 // mipmapped
#define TEX_CLAMP   5 // clamped, mipmapped


came from? The red color denotes direct copy-paste from you forum message. Those were my attempts to GL_CLAMP_TO_BORDER your mipmapped/gl_wrapped wallpapers that kept displaying those notorious wrongly colored scan lines all around the viewport borders, caused effectively by uncontrolled rescaling, mipmapping and illegal gl_wrapping the wallpaper around its quad's edges -- and all this with no access to your closed-source texture loading function you bulldozed me to use. ;) You know very well I'm perfectly able to code my own texture loading procs from scratch in ca. 10 minutes that would be completely devoid of this crap -- but I wasn't allowed to! ::)

I tried to mask off the ugly edges as best I could from outside the function code, but obviously there wasn't much I could really do back at those times.

To cut it short, I know the wallpaper is still not resized nor rendered 100% correctly and I will fix it eventually, but it certainly isn't going to be item #1 on my current top priority list. In the mean time, I'm afraid you'll have to put up with it; just try not to stretch the viewport across multiple monitors to keep its aspect ratio within reasonable limits and preclude visible distortion of the wallpaper ovals.

Oh, and avoid the (O)BLIVION wallpaper castrated by POT rescaling in GDImage.

 :-X


P.S. Will you send me the OR v2.0 sources, please? I'm not keeping an archive of deprecated code -- I've got too many forks of current one to have time or nerve to look back over my shoulder.
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: Early WIP on v2.55
« Reply #208 on: November 18, 2018, 11:03:21 am »
My friend,

Yes, i prefer to see the black borders aside the texture than image distortion.
This is how it works in my old BassBox OpenGL plugins since the first release, and in the original OR 32-bit version as shown on your screen shot.
(ZI_ResizeGLWindow in GDImage)
Indeed this is the same to what i am doing when resizing a video while playing a movie (see MBox64).
This is also the reason why, now i am always using full HD image (1920x1080) to create my wallpaper backgrounds.

And the iconise function that i am using in all my projects to resize an image, while preserving its aspect.

Code: [Select]
void ZI_Iconise (IN long xPicSize, IN long yPicSize, IN long xCell, IN long yCell, OUT long &xPos, OUT long &yPos, OUT long &xSize, OUT long &ySize) { // dllexport
    float rScale = 0.0f;
    if (xPicSize) { rScale = (float) (xCell / (float) xPicSize); }
    if (rScale > 1) { rScale = 1.0f; }
    xSize = (long) (xPicSize * rScale); ySize = (long) (yPicSize * rScale);
    // In case Height > 150 compute new scale factor
    if (ySize > yCell) {
        if (yPicSize) { rScale = (float) (yCell / (float) yPicSize); }
        xSize = (long) (xPicSize * rScale); ySize = (long) (yPicSize * rScale);
    }
    xPos = (long)((xCell - xSize) * 0.5f); yPos = (long)((yCell - ySize) * 0.5f);
}

The code of version 2.00 is attached to this post.


« Last Edit: November 18, 2018, 11:43:56 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #209 on: November 18, 2018, 12:59:21 pm »
OK Patrice,

I heard your say.

There's 1024% sure gonna be another #ifndef MLL_DEV block in the code.

Your "wallpaper" (in fact, just another billboard in sight) has always been making me dizzy. It describes how different our attitudes are to the worlds we're trying to create in our viewports. I'm trying to immerse into mine and stay inside looking out while you prefer to stay outside yours looking in. :)

Secondly, 1920x1080 full HD is still too low-res for your algo. ObjReader is unable to run on anything other than pretty advanced HW, and it won't even launch on a typical business-class notebook. OTOH a decent modern desktop setup is usually equipped with at least two monitors (mine uses three of them, all horizontal), and the most advanced would use four in a 2x2 matrix (I'm just too reluctant to drill holes in the walls of my study and suspend the upper two on the wall mounts). So your wallpapers should come in at least 4Kx2K pxs so that ObjReader could look into the scene through its viewport frustum regardless of its size or aspect without the need to shrink or stretch the wallpaper. Then there will never be any margins or distortion in your preferred rendering solution, unless the number of horizontal and/or vertical monitors exceeds two in a row.

Lastly, the wallpapers may stay 1920 pxs high but should be made tilable horizontally (and that imposes certain restrictions on their visual content). Then their textures may be loaded wrappable only horizontally (S clamped to edge and T wrapped), so that another horizontal tile would just slide silently into view on either side of the main image as the respective margin of the main window is dragged in either horizontal direction. That will solve the problem at least partially for the horizontal layout of monitors in the workstation regardless of their actual number in a row (2, 3, or 4).

Do you think your 2D skills can procure us with such tilable wallpaper images? There are descriptions of techniques on the net on how to create tilable images in modern image editors like Photoshop or Gimp.

Thanks for the v2.0 code. I'll see what I can do in the mean time.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)