Skip to content

Commit 83054dd

Browse files
committed
Add color_ramp
1 parent b94c8f2 commit 83054dd

File tree

8 files changed

+1592
-2
lines changed

8 files changed

+1592
-2
lines changed

include/mitsuba/core/object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ NAMESPACE_BEGIN(mitsuba)
2828
* and has no overhead for references.
2929
*/
3030
class MI_EXPORT_LIB Object {
31+
3132
public:
3233
/// Default constructor
3334
Object() { }

include/mitsuba/render/fwd.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ template <typename Float_, typename Spectrum_> struct RenderAliases {
105105
using ShapePtr = dr::replace_scalar_t<Float, const Shape *>;
106106
using SensorPtr = dr::replace_scalar_t<Float, const Sensor *>;
107107
using EmitterPtr = dr::replace_scalar_t<Float, const Emitter *>;
108+
using TexturePtr = dr::replace_scalar_t<Float, const Texture *>;
108109
};
109110

110111
#define MMI_USING_MEMBERS_MACRO2(x) \
@@ -186,6 +187,7 @@ template <typename Float_, typename Spectrum_> struct RenderAliases {
186187
using MediumPtr = typename RenderAliases::MediumPtr; \
187188
using ShapePtr = typename RenderAliases::ShapePtr; \
188189
using EmitterPtr = typename RenderAliases::EmitterPtr; \
189-
using SensorPtr = typename RenderAliases::SensorPtr;
190+
using SensorPtr = typename RenderAliases::SensorPtr; \
191+
using TexturePtr = typename RenderAliases::TexturePtr;
190192

191193
NAMESPACE_END(mitsuba)

include/mitsuba/render/texture.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ class MI_EXPORT_LIB Texture : public Object {
226226
/// Set a string identifier
227227
void set_id(const std::string& id) override { m_id = id; };
228228

229+
DRJIT_VCALL_REGISTER(Float, mitsuba::Texture)
230+
229231
MI_DECLARE_CLASS()
230232

231233
protected:
@@ -238,3 +240,23 @@ class MI_EXPORT_LIB Texture : public Object {
238240

239241
MI_EXTERN_CLASS(Texture)
240242
NAMESPACE_END(mitsuba)
243+
244+
245+
// -----------------------------------------------------------------------
246+
//! @{ \name Dr.Jit support for vectorized function calls
247+
// -----------------------------------------------------------------------
248+
249+
DRJIT_VCALL_TEMPLATE_BEGIN(mitsuba::Texture)
250+
DRJIT_VCALL_METHOD(eval)
251+
DRJIT_VCALL_METHOD(sample_spectrum)
252+
DRJIT_VCALL_METHOD(pdf_spectrum)
253+
DRJIT_VCALL_METHOD(sample_position)
254+
DRJIT_VCALL_METHOD(pdf_position)
255+
DRJIT_VCALL_METHOD(eval_1)
256+
DRJIT_VCALL_METHOD(eval_1_grad)
257+
DRJIT_VCALL_METHOD(eval_3)
258+
DRJIT_VCALL_METHOD(mean)
259+
DRJIT_VCALL_TEMPLATE_END(mitsuba::Texture)
260+
261+
//! @}
262+
// -----------------------------------------------------------------------

src/bsdfs/principled.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class Principled final : public BSDF<Float, Spectrum> {
213213

214214
/*Eta and specular has one to one correspondence, both of them can
215215
* not be specified. */
216-
if (props.has_property("eta") && props.has_property("specular")) {
216+
if (props.has_property("eta") && props.has_property("specular")) { // TODO: ask
217217
Throw("Specified an invalid index of refraction property "
218218
"\"%s\", either use \"eta\" or \"specular\" !");
219219
} else if (props.has_property("eta")) {

src/core/plugin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const Class *PluginManager::get_plugin_class(const std::string &name,
147147

148148
auto it = std::find(d->m_python_plugins.begin(), d->m_python_plugins.end(),
149149
name + "@" + variant);
150+
150151
if (it != d->m_python_plugins.end()) {
151152
plugin_class = Class::for_name(name, variant);
152153
} else {
@@ -178,6 +179,7 @@ ref<Object> PluginManager::create_object(const Properties &props,
178179
return class_->construct(props);
179180

180181
std::string variant = class_->variant();
182+
181183
const Class *plugin_class = get_plugin_class(props.plugin_name(), variant);
182184

183185
/* Construct each plugin in its own scope to isolate them from each other.

src/textures/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ add_plugin(bitmap bitmap.cpp)
44
add_plugin(checkerboard checkerboard.cpp)
55
add_plugin(mesh_attribute mesh_attribute.cpp)
66
add_plugin(volume volume.cpp)
7+
add_plugin(color_ramp color_ramp.cpp)
78

89
set(MI_PLUGIN_TARGETS "${MI_PLUGIN_TARGETS}" PARENT_SCOPE)

0 commit comments

Comments
 (0)