Jump to content

C++ framework for 3.1?


shadmar
 Share

Recommended Posts

I like the idea of an effect collection. How do you see it working though? How do you know what effect you're adding? We would need some kind of identifier on each effect. This requires knowing all effects. I think this works for the base stuff we know today, but would have to be updated when new effects come out. How do you see this working?

 

 

Update RenderFramework with delete and clear effects. My C++ is a little rusty but I think I have the idea. Just doing this in notepadd++ so not checking for compiling.

 

class RenderFramework
{
private:
World* bgWorld;
World* fgWorld;
Buffer* bgBuffer;
Buffer* fgBuffer;

list<IEffect*> effects;
public:
void RenderFramework()
{
// create the worlds and buffers
}

IEffect* AddEffect(IEffect* effect)
{
effect->SetBGWorld(bgWorld);
// etc. set the effects worlds/buffers

// add this effect
effects.push_back(effect);
}

void RemoveEffect(IEffect* effect)
{
list<IEffect*>::iterator iter;
for(iter = effects.begin(); iter != effects.end(); ++iter)
{
if(effect == (*iter))
{
// store off our effect so we can delete it
IEffect* e = (*iter);

// remove this entry in the list
effects.erase(iter);

// delete our effect
delete e;

return;
} 
}
}

void ClearAllEffects()
{
list<IEffect*>::iterator iter;
for(iter = effects.begin(); iter != effects.end(); ++iter)
{
delete (*iter);
}

effects.clear();
}

void Update()
{
// loop over effects and call Update()
}

void Render()
{
// loop over effects and call Render()
}
};

  • Upvote 1
Link to comment
Share on other sites

Well it depends a bit on how shaders work (and my knowledge on them is very low). Lets say shadmar has created 3 post effects that need to be in a certain order, he can make a new class deriving from EffectCollection and add his effects in the order they are supposed to work.

 

Although you still have the freedom, you also have a container of effects that belong together. But this is something shadmar needs to shed some light on. I have no idea if this way would be ideal.

Link to comment
Share on other sites

Ah ok, so the idea being the creator of the shaders can make a collection class that combines effects and adds them in the "right" order and then users can make an instance of this class and they get a predefined look. I like that idea as it still allows for users to create their own order of effects or just use a predefined order via a collection class predefined by someone. They are just like helper classes to get a predefined look. I like that as a helper class. I don't think getting the order of something is overly complicated, but this can help for sure.

Link to comment
Share on other sites

The framework class in LE2 was a horrible hack when I realized no one knew how to use the old post-effects system. The modular post-effects system in 3.1 replaces that.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

@Josh I think the main question here is the requirement for multiple worlds/buffers. Shadmar is saying that it's possibly more efficient to have multiple worlds/buffers and the current 3.1 system seems to use just 1? My understanding is that we can use Lua scripts as a post-processor (which allows us to create more worlds/buffers if we need) which is great, but that's only Lua and not C++. The C++ crowd could still use something that helps with this. What we are proposing here seems a lot like Lua post processor scripts but just C++ classes for the the C++ people. Same idea but for C++.

Link to comment
Share on other sites

Ok I suggest we use a github repo, has free issue tracker, and wiki, storage is also free for open source projects.

If anyone needs a quick intro/tutorial in using github and git (command line) I can do that.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

@Josh I think the main question here is the requirement for multiple worlds/buffers. Shadmar is saying that it's possibly more efficient to have multiple worlds/buffers and the current 3.1 system seems to use just 1?

The whole multiple world thing was a bad hack. Why would you need this?

 

@Josh I think the main question here is the requirement for multiple worlds/buffers. Shadmar is saying that it's possibly more efficient to have multiple worlds/buffers and the current 3.1 system seems to use just 1? My understanding is that we can use Lua scripts as a post-processor (which allows us to create more worlds/buffers if we need) which is great, but that's only Lua and not C++. The C++ crowd could still use something that helps with this. What we are proposing here seems a lot like Lua post processor scripts but just C++ classes for the the C++ people. Same idea but for C++.

The advantage of Lua script effects is that it can just be inserted into any program without recompiling, including C++ programs. These scripts are very simplistic. Usually all they would do is bind some textures and manage buffers, as my example bloom script does. I was really hoping people would focus more on making games instead of trying to re-engineer the renderer. The current system is designed so that if one person makes a plugin effect, everyone benefits. If you branch the renderer, you are isolating yourself from a lot of content you could be using.
  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

What we are talking about sound the same, but one is Lua and the other is C++. Really the only difference I see in this design is the ability to pass parameters to the effect so it can be passed to the shader to allow for even more customization within each effect. Also, perhaps the ability to alter the effect at run-time by the means of these variables?

 

Shadmar could probably list other limitations he's seeing for the reason he asked for this.

Link to comment
Share on other sites

Yeah, that's going to be a limitation for a little while, but it's best to do these things one step at a time. First we get the Workshop launched, make sure the effects system works as intended, then add some more customizable controls. It will come.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I thought of worlds as rendertargets, if you want to do refraction.

 

If you only use one world :

Render world without refracted mesh

Pass buffer to refract shader

Render world again with everything. <-- wouldn't this be a bit overkill, if you could render this alone using 2 worlds instead of most of it again?

 

I really like the current lua effects system and certainly don't want to branch the renderer i any form.

So if you think this would be a waste of time, then I'm in no hurry :)

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

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.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...