Difference between revisions of "Implementing a Texture"

From LuxCoreRender Wiki
Jump to navigation Jump to search
Line 17: Line 17:


==== Modifying Sceneparse ====
==== Modifying Sceneparse ====
TODO
 
Open src/slg/scene/parsetextures.cpp<br>
Include the new header file you created for your texture (the list is alphabetic).
 
Next, go to the method <code>Scene::CreateTexture</code>, scroll down until the end of the big <code>if/else</code> statement and add a new <code>else if</code> for your texture.


==== Modifying CMakeLists.txt ====
==== Modifying CMakeLists.txt ====

Revision as of 14:13, 18 June 2018

C++ Code

Files that need to be created:

  • Header: include/slg/textures/yourtexturename.h
  • Source: src/slg/textures/yourtexturename.cpp

Files that need to be edited:

  • Base texture header: include/slg/textures/texture.h
  • Sceneparse: src/slg/scene/parsetextures.cpp
  • CMakeLists.txt: src/slg/CMakeLists.txt

Commit with example: adding the "Divide" texture: https://github.com/LuxCoreRender/LuxCore/commit/ce6e23c244b1bb426c1dcd13099a41982e565b88

Modifying the base texture header

Open the file include/slg/textures/texture.h
Add your new texture type to the TextureType enum.

Modifying Sceneparse

Open src/slg/scene/parsetextures.cpp
Include the new header file you created for your texture (the list is alphabetic).

Next, go to the method Scene::CreateTexture, scroll down until the end of the big if/else statement and add a new else if for your texture.

Modifying CMakeLists.txt

TODO

Compile and Test

To test your plugin, compile LuxCore: Compiling_LuxCore

After the compilation succeeds, you will need a scene to test your plugin. The easiest method is to edit one of the .scn files in the scenes/luxball directory.

TODO Example

Now, run luxcoreui from the root LuxCore directory with

./bin/luxcoreui ./scenes/luxball/luxball-sunset.cfg

TODO result example image

OpenCL Code

TODO