Skip to content

Commit

Permalink
Merge branch 'materialeditor2'
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 22, 2021
2 parents 66987e2 + 32c978c commit 9241f16
Show file tree
Hide file tree
Showing 87 changed files with 29,708 additions and 20,340 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -83,3 +83,4 @@ Makefile.in
/tools/msvc/x64
/tools/msvc/packages
/install/*.testdurations
*.ilk
3 changes: 3 additions & 0 deletions include/ibrush.h
Expand Up @@ -231,6 +231,9 @@ class IBrush
// Add a new face to this brush, using the given plane, texdef matrix and shader name
virtual IFace& addFace(const Plane3& plane, const Matrix4& texDef, const std::string& shader) = 0;

// Removes all faces from this brush
virtual void clear() = 0;

// Returns true when this brush has no faces
virtual bool empty() const = 0;

Expand Down
17 changes: 8 additions & 9 deletions include/iglrender.h
Expand Up @@ -3,8 +3,7 @@
#include "igl.h"
#include "imodule.h"
#include "ishaders.h"

#include "ShaderLayer.h"
#include "ishaderlayer.h"

#include "math/Vector4.h"

Expand Down Expand Up @@ -173,11 +172,11 @@ class OpenGLState
* which hold the actual values of many parameters, some of them
* time-dependent or depending on entity parameters.
*/
ShaderLayerPtr stage0;
ShaderLayerPtr stage1;
ShaderLayerPtr stage2;
ShaderLayerPtr stage3;
ShaderLayerPtr stage4;
IShaderLayer::Ptr stage0;
IShaderLayer::Ptr stage1;
IShaderLayer::Ptr stage2;
IShaderLayer::Ptr stage3;
IShaderLayer::Ptr stage4;

/**
* \brief
Expand Down Expand Up @@ -212,7 +211,7 @@ class OpenGLState
* \brief
* The cube-map texgen mode for rendering.
*/
ShaderLayer::CubeMapMode cubeMapMode;
IShaderLayer::CubeMapMode cubeMapMode;

/// Default constructor
OpenGLState()
Expand All @@ -236,6 +235,6 @@ class OpenGLState
m_linestipple_factor(1),
m_linestipple_pattern(0xAAAA),
glProgram(NULL),
cubeMapMode(ShaderLayer::CUBE_MAP_NONE)
cubeMapMode(IShaderLayer::CUBE_MAP_NONE)
{ }
};
6 changes: 3 additions & 3 deletions include/imodel.h
Expand Up @@ -165,7 +165,7 @@ class IModelExporter

/**
* Importer interface for models. An importer must be able
* to load a model (node) from the VFS.
* to load a model (node) from the VFS and from an absolute path.
* The importer instance shouldn't maintain an internal state,
* such that the same instance can be used to load several models,
* from different client code.
Expand All @@ -186,10 +186,10 @@ class IModelImporter
virtual scene::INodePtr loadModel(const std::string& modelName) = 0;

/**
* Load a model from the VFS, and return the IModel subclass for it.
* Load a model from the given (maybe be VFS or absolute), and return the IModel subclass for it.
*
* @returns: the IModelPtr containing the renderable model or
* NULL if the model loader could not load the file.
* an empty IModelPtr if the model loader could not load the file.
*/
virtual model::IModelPtr loadModelFromPath(const std::string& path) = 0;
};
Expand Down
13 changes: 8 additions & 5 deletions include/imodelcache.h
Expand Up @@ -16,23 +16,26 @@ class IModelCache :
public:
/**
* greebo: This method returns the readily fabricated scene::Node
* containing the suitable model node. The modelPath is analysed
* and the correct ModelLoader is invoked to create the node.
* containing the suitable model node. The modelPath is analysed
* and the correct ModelLoader is invoked to create the node.
*
* @returns: a valid scene::INodePtr, which is never NULL. If the model
* could not be loaded, the fallback "NullModel" is returned.
* could not be loaded, the fallback "NullModel" is returned.
*/
virtual scene::INodePtr getModelNode(const std::string& modelPath) = 0;

/**
* greebo: Get the IModel object for the given VFS path. The request is cached,
* so calling this with the same path twice will return the same
* IModelPtr to save memory.
* so calling this with the same path twice will return the same
* IModelPtr to save memory.
*
* This method is primarily used by the ModelLoaders to acquire their model data.
*/
virtual IModelPtr getModel(const std::string& modelPath) = 0;

// Loads a model from the static resources in DarkRadiant's runtime data/resources folder
virtual scene::INodePtr getModelNodeForStaticResource(const std::string& resourcePath) = 0;

// This reloads all models in the map
virtual void refreshModels(bool blockScreenUpdates = true) = 0;

Expand Down
11 changes: 7 additions & 4 deletions include/irender.h
Expand Up @@ -6,7 +6,7 @@
#include "math/Vector3.h"
#include "math/AABB.h"

#include "ShaderLayer.h"
#include "ishaderlayer.h"
#include <sigc++/signal.h>

/**
Expand Down Expand Up @@ -305,14 +305,14 @@ class RenderInfo
Vector3 _viewerLocation;

// Cube map mode
ShaderLayer::CubeMapMode _cubeMapMode;
IShaderLayer::CubeMapMode _cubeMapMode;

public:

/// Default constructor
RenderInfo(RenderStateFlags flags = RENDER_DEFAULT,
const Vector3& viewer = Vector3(0, 0, 0),
ShaderLayer::CubeMapMode cubeMode = ShaderLayer::CUBE_MAP_NONE)
IShaderLayer::CubeMapMode cubeMode = IShaderLayer::CUBE_MAP_NONE)
: _flags(flags),
_viewerLocation(viewer),
_cubeMapMode(cubeMode)
Expand All @@ -337,7 +337,7 @@ class RenderInfo
}

/// Get the cube map mode.
ShaderLayer::CubeMapMode getCubeMapMode() const
IShaderLayer::CubeMapMode getCubeMapMode() const
{
return _cubeMapMode;
}
Expand Down Expand Up @@ -562,6 +562,9 @@ class RenderSystem

// Subscription to get notified as soon as the openGL extensions have been initialised
virtual sigc::signal<void> signal_extensionsInitialised() = 0;

// Notification about a material change, tries to refresh any constructed shaders basing on it
virtual void onMaterialChanged(const std::string& materialName) = 0;
};
typedef std::shared_ptr<RenderSystem> RenderSystemPtr;
typedef std::weak_ptr<RenderSystem> RenderSystemWeakPtr;
Expand Down
17 changes: 16 additions & 1 deletion include/ishaderexpression.h
Expand Up @@ -38,6 +38,8 @@ enum ReservedRegisters
class IShaderExpression
{
public:
using Ptr = std::shared_ptr<IShaderExpression>;

/**
* Retrieve the floating point value of this expression. DEPRECATED
*/
Expand Down Expand Up @@ -68,10 +70,23 @@ class IShaderExpression
*/
virtual std::size_t linkToRegister(Registers& registers) = 0;

// Link this expression to the given Registers vector, using the specified index
// instead of allocating a new register
virtual void linkToSpecificRegister(Registers& registers, std::size_t index) = 0;

// True if this expression is linked to a register
virtual bool isLinked() const = 0;

// Returns any previously used register position (for possible re-use)
virtual std::size_t unlinkFromRegisters() = 0;

// Returns the string this expression has been parsed from
virtual std::string getExpressionString() = 0;

// Clone this expression and all possible sub-expressions
// The cloned expression will not be linked to any register
virtual IShaderExpression::Ptr clone() const = 0;
};
typedef std::shared_ptr<IShaderExpression> IShaderExpressionPtr;

// Interface of a material expression used to specify a map image
// It can either represent a texture path to a file on disk or
Expand Down

0 comments on commit 9241f16

Please sign in to comment.