Skip to content

Conversation

@jpchip
Copy link
Owner

@jpchip jpchip commented Oct 19, 2016

Added custom render mode BoundsOverlay to overlay colors within sets of bounding boxes. An example usage in a config file would be:

renders['day'] = {
    'world': 'myWorld',
    'rendermode': 'smooth_lighting',
    'title': "Daytime Render",
}

renders["boundsoverlay"] = {
        'world': 'myWorld',
        'title': 'Land Ownership',
        'rendermode': [Base(), BoundsOverlay(bounds=[
                        (((0, 0, 16, 16),), (255, 160, 122, 255)),
                        (((17, 17, 23, 23),(24, 24, 40, 40)), (75, 0, 130, 255)),
                       ])],
        'overlay': ['day']
}

@jpchip jpchip assigned jpchip and unassigned jpchip Oct 19, 2016
@jpchip
Copy link
Owner Author

jpchip commented Oct 20, 2016

Here is a screenshot showing some random areas I picked filled in.

screenshot 2016-10-19 21 49 57

@theraccoonbear
Copy link
Collaborator

So, it looks like it's actually placing the overlay on the "top" level, meaning blocks with only sky above? Looks like a solid approach, though I'm curious if you can adjust the opacity of the overlay?

@theraccoonbear theraccoonbear self-assigned this Oct 20, 2016
@jpchip
Copy link
Owner Author

jpchip commented Oct 20, 2016

You can adjust the opacity, the last number defining the color is the alpha (ie. (r, g, b, a)) and can be set from 0-255.


/* first, chain up */
int ret = primitive_overlay.start(data, state, support);
if (ret != 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I prefer to always wrap conditional blocks in curly brackets, but I'm not sure what the upstream project's styles (and C, generally) dictates as the standard.


// opt is a borrowed reference. do not deref
// store the bounds python object into opt.
if (!render_mode_parse_option(support, "bounds", "O", &(opt)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@theraccoonbear
Copy link
Collaborator

Other than those nitpicks, LGTM. Did you want me to merge this?

@jpchip
Copy link
Owner Author

jpchip commented Oct 20, 2016

I will fix those nitpickets first.

@jpchip jpchip assigned theraccoonbear and unassigned jpchip Oct 21, 2016
@jpchip
Copy link
Owner Author

jpchip commented Oct 21, 2016

Example with 50% opacity:
screenshot 2016-10-20 21 26 19

Setup file code that generated it:

renders["boundsoverlay"] = {
        'world': 'woot',
        'title': 'Land Ownership',
        'rendermode': [ClearBase(), BoundsOverlay(bounds=[
                        (((0, 0, 16, 16), (-70, -30, -54, -14)), (255, 160, 122, 127)),
                        (((100, 100, 116, 116),(17, 0, 33, 16)), (75, 0, 130, 127)),
                       ])],
        'overlay': ['day']
}

@theraccoonbear
Copy link
Collaborator

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants