Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normal map prototype #1932

Closed
wants to merge 5 commits into from
Closed

Conversation

HarsimranVirk
Copy link
Contributor

@HarsimranVirk HarsimranVirk commented Aug 20, 2020

Early stage:

  • Declare abstract methods such as getNormalMapRendererObject.

  • Get render texture of normal map world.

  • Add a new RuntimeObject and gdjs.LightsManager to track position of lights.

  • Define and apply filter for diffused rendering.

* A pixi filter for diffused rendering.
* @param {gdjs.RuntimeSceneRenderer} runtimeSceneRenderer
*/
gdjs.ForwardDiffusedRenderFilter = function (runtimeSceneRenderer) {
Copy link
Contributor Author

@HarsimranVirk HarsimranVirk Aug 20, 2020

Choose a reason for hiding this comment

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

@4ian how do I import this class? It doesn't fit as an object, behavior or effect, how do I use JsExtension in this case?

EDIT: Also at some point, I'd need to import gdjs.LightsManager as well 🤔.

Copy link
Owner

Choose a reason for hiding this comment

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

As it's part of an extension, it should be included by the extension whenever needed, which is surely whenever one of the new "light" object is used. As you don't have any new "light" object for now, consider either:

  • "hacking" you way by adding addIncludeFile to some action, condition or existing object. Don't forget to put a big TODO
  • OR maybe this filter should be part of the game engine itself when using pixi? In this case, add it in GDJS/Runtime/pixi-renderers and list it in ExporterHelper::AddLibsInclude in ExporterHelper.cpp. Though this means every game will include it even if not used, so maybe less ideal... but maybe we'll still need this because the rendering of normal map lighting will be tightly integrated in the pixi game engine.

@@ -337,6 +338,10 @@ gdjs.RuntimeObject.prototype.getRendererObject = function() {
return undefined;
};

gdjs.RuntimeObject.prototype.getNormalMapRendererObject = function() {
return undefined;
Copy link
Owner

Choose a reason for hiding this comment

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

ubernit: I prefer to return null because undefined can mean "you accessed a property that is not even defined, surely something wrong" while null is explictly meaning "this is representing a valid value, but this value is null, i.e: there is no normal map object here".

@@ -318,6 +318,7 @@ gdjs.RuntimeObject.prototype.deleteFromScene = function(runtimeScene) {
*/
gdjs.RuntimeObject.prototype.onDestroyFromScene = function(runtimeScene) {
var theLayer = runtimeScene.getLayer(this.layer);

Copy link
Owner

Choose a reason for hiding this comment

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

You'll need to adapt every place where getRendererObject/getRenderer is used to optionally do the same with the normal map object. This is: onDestroyFromScene, setZOrder, setLayer.

@HarsimranVirk HarsimranVirk deleted the normals-proto branch June 12, 2021 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants