Jump to content
The Dark Mod Forums

Show Lightvolumes


Recommended Posts

I'm currently working on adding the according ToggleToolButton to toggle the "show all light volumes" state.

 

What's the best way to define a global variable that can be accessed from both mainframe.cpp and plugins/entity/lights.cpp? I'm somehow struggling with this, I always get a linker error if I define the variable in a header file that's included by those two cpps.

 

Apart from that everything's working fine, it's just the global I need to query.

Link to comment
Share on other sites

What's the best way to define a global variable that can be accessed from both mainframe.cpp and plugins/entity/lights.cpp? I'm somehow struggling with this, I always get a linker error if I define the variable in a header file that's included by those two cpps.

 

I thought you might run into that. As you have noticed, the lights are rendered by the entity plugin which has no access to the state of the toolbars or other Radiant config widgets.

 

There are three solutions which spring to mind:

 

1. Use some horrible "extern" global variables that can be accessed by both entity.dll and DarkRadiant itself. I don't recommend this (I have never done it and wouldn't know how to) but sharing variables between DLLs like this is an option. You might also run into problems with calling conventions across platforms (underscore versus no underscore in symbol names et.c) if you do this.

2. Add an extra function to the Radiant Module interface (include/qerplugin.h) to allow modules to query the state of the UI, just like I did with getXPath().

3. Merge the ui and game XML trees like we discussed, so that modules can get UI state by looking up paths like GlobalRadiant().getXPath("/ui/state/showAllLightRadii") in the same way they can look up game paths.

 

In the long run I think (3) would be the best, but if the merging of XML structures is not so easy then (2) would be acceptable.

Link to comment
Share on other sites

Okay, I've added the solution as described in (2), so the "Show all light volumes" button is functional now (already on SVN).

 

I will have a look at the XML library and see if I can implement (3) as well :-)

Link to comment
Share on other sites

Wow that was quick. At this rate DarkRadiant will be finished soon...

 

When you were examining the render code for the lights, did you get any idea of how difficult it would be to create a function to overlay light falloff textures on their 2D volume renderings? I thought this might be a nice feature to help people line up lights without relying on the render view, but I don't know how difficult it would be.

Link to comment
Share on other sites

When you were examining the render code for the lights, did you get any idea of how difficult it would be to create a function to overlay light falloff textures on their 2D volume renderings? I thought this might be a nice feature to help people line up lights without relying on the render view, but I don't know how difficult it would be.

Heh, I got the same idea yesterday :) Not a high-priority feature, I'd say, but still nice to have.

 

I think it's possible, as there are a lot of cascaded render() methods and it's just a matter of finding the right one, but I need to know the appropriate GL commands (which I need to learn anyway), before I could test anything in that direction.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...