[Done] Rendering opaque and transparent separately

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Rendering opaque and transparent separately

Postby Ident » Sun Sep 04, 2016 22:33

YaronCT wrote:@Ident: Perhaps what u can do is add the new "draw" method and leave the old one too. The default implementation of the new 1 will simply call the old one, ignoring the draw-mode (and perhaps do "assert(drawModeMask == DrawModeMaskAll)").

Yea but that is quite meh.
CrazyEddie: "I don't like GUIs"

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Sun Sep 04, 2016 22:38

Ident wrote:
YaronCT wrote:@Ident: Perhaps what u can do is add the new "draw" method and leave the old one too. The default implementation of the new 1 will simply call the old one, ignoring the draw-mode (and perhaps do "assert(drawModeMask == DrawModeMaskAll)").

Yea but that is quite meh.


Y?

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 06:04

Ident wrote:
YaronCT wrote:
Ident wrote:The question though is, does it need to work the same if you rebuild for USING the API as in calling the functions or also for DERIVING from its classes, because if you say the latter is the case, well, then you could not add ANY function ever because someone might have added it in a subclass and then that wouldnt compile anymore, right? ;) It is not all black and white if you ask me and we just need to define where we draw the line or it will mean you cant do ANYTHING in v0 that you cant do in v0-8.


Y wouldn't it compile anymore?

Oh well I guess you are right about already existing user-functions, they will just be overriding the base function in the virtual case but then you at least can be pretty sure they wont work as expected, as it is unlikely the user does the expected thing there.

But for member variables you definitely clash.


Sorry, you're right, if there's a name clash, even if it compiles it's not guaranteed to behave the same, something I consider a flew in C++'s design which could have been easily fixed. So, in this sense, it's indeed not black or white, yet changing the prototype of an exposed function is obviously black. What we can do, though, is to lessen the chance that a name clash happens. Say, u can call the new "draw" method "drawWithMode", or even "drawWithModeByLukasMeindlId0047834981984" or something.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Rendering opaque and transparent separately

Postby Ident » Mon Sep 05, 2016 19:00

This is all too much. Martin is also for merging it to default only. I will do that and niello will have to live in the branch I made for him :) wouldn't recommend switching to default branch yet.
CrazyEddie: "I don't like GUIs"

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 19:01

YaronCT wrote:
Ident wrote:
YaronCT wrote:@Ident: Perhaps what u can do is add the new "draw" method and leave the old one too. The default implementation of the new 1 will simply call the old one, ignoring the draw-mode (and perhaps do "assert(drawModeMask == DrawModeMaskAll)").

Yea but that is quite meh.


Y?


bump.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Rendering opaque and transparent separately

Postby Ident » Mon Sep 05, 2016 19:12

YaronCT wrote:
YaronCT wrote:
Ident wrote:Yea but that is quite meh.


Y?


bump.

I can't remember my exact thoughts but I d prefer to go the reverse route: draw() should call draw(DrawModeMaskAll);
It feels a bit dirty though, not this but the entire thing. I cant point a finger at the specific thing right now though
CrazyEddie: "I don't like GUIs"

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 20:52

@Ident:
I d prefer to go the reverse route: draw() should call draw(DrawModeMaskAll);


That was my 1st though too and is obviously prefered but I don't think will work here, coz e.g. "RenderingSurface::draw()" would call "RenderingSurface::draw(uint32 drawModeMask)" which would call "RenderTarget::draw(uint32 drawModeMask)" which wouldn't call "RenderTarget::draw()" which may b overridden so you're screwed.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 20:56

@Ident:
It feels a bit dirty though


Keeping ABI/API comtability *is* dirty. I don't think what we do here - using 2 prototypes for a function when one calls the other - is something not already done in cegui, or that it's dirtier than using a user string to store a property or than using a D-pointer - also things I think we already do.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 21:00

@Ident:
Martin is also for merging it to default only

I can't remember my exact thoughts

I cant point a finger at the specific thing right now though

Lol that's all very nice but makes it quite hard to debate the issue..

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 21:21

YaronCT wrote:@Ident:
I d prefer to go the reverse route: draw() should call draw(DrawModeMaskAll);


That was my 1st though too and is obviously prefered but I don't think will work here, coz e.g. "RenderingSurface::draw()" would call "RenderingSurface::draw(uint32 drawModeMask)" which would call "RenderTarget::draw(uint32 drawModeMask)" which wouldn't call "RenderTarget::draw()" which may b overridden so you're screwed.


In 2nd thought my solution is problematic too - instead we can have in all classes "draw()" call "draw(DrawModeMaskAll)" and e.g. "RenderingSurface::draw(uint32 drawModeMask)" do:

Code: Select all

if (drawModeMask == DrawModeMaskAll)
    d_target->draw();
else
    d_target->draw(drawModeMask);

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 21:26

Ah, heck, just do it in branch "default". :rofl:

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Rendering opaque and transparent separately

Postby Ident » Mon Sep 05, 2016 21:56

YaronCT wrote:Ah, heck, just do it in "default". :rofl:

- There is not going to be a v0 release
- There is probably only niello seriously going to use this for now
- We already thought way more about this than it is worth our dev time :D
- Let's just put this in default :3 :pint:
CrazyEddie: "I don't like GUIs"

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Rendering opaque and transparent separately

Postby Ident » Mon Sep 05, 2016 22:14

YaronCT wrote:@Ident:
Martin is also for merging it to default only

I can't remember my exact thoughts

I cant point a finger at the specific thing right now though

Lol that's all very nice but makes it quite hard to debate the issue..


Martin really didnt say much else on this this time, and I am super tight on time currently so I couldnt make up my mind. I had like 30 minutes leisure time today lol, the rest was work, errands, fucking austrian bureaucracy, and cleaning the rat cage.

I will merge it into default tomorrow and if anyone thinks they got a solution for v0 for this that doesnt break API then they are free to commit it / make a PR :D
CrazyEddie: "I don't like GUIs"

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 22:55

@Ident: I do have a solution. Each class would have 3 "draw" methods:

Code: Select all

void draw(uint32 drawModeMask)
{
    if (drawModeMask == DrawModeMaskAll)
        draw();
    else
        draw_impl(drawModeMask);
}

virtual void draw()
{
    draw_impl(DrawMastAll);
}

virtual void draw_impl(uint32 drawModeMask)
{
    // The actual draw goes here.
}


But that starts being too dirty even to my eyes..

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Rendering opaque and transparent separately

Postby YaronCT » Mon Sep 05, 2016 22:57

Sorry, code had a mistake, I've corrected it.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 16 guests