Fix T48783: OSL render errors after recent refactoring.
This commit is contained in:
@@ -912,7 +912,7 @@ bool OSLRenderServices::texture(ustring filename,
|
|||||||
#endif
|
#endif
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
if(filename[0] == '@') {
|
if(filename.length() && filename[0] == '@') {
|
||||||
int slot = atoi(filename.c_str() + 1);
|
int slot = atoi(filename.c_str() + 1);
|
||||||
float4 rgba = kernel_tex_image_interp(slot, s, 1.0f - t);
|
float4 rgba = kernel_tex_image_interp(slot, s, 1.0f - t);
|
||||||
|
|
||||||
@@ -993,7 +993,7 @@ bool OSLRenderServices::texture3d(ustring filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool status;
|
bool status;
|
||||||
if(filename[0] == '@') {
|
if(filename.length() && filename[0] == '@') {
|
||||||
int slot = atoi(filename.c_str() + 1);
|
int slot = atoi(filename.c_str() + 1);
|
||||||
float4 rgba = kernel_tex_image_interp_3d(slot, P.x, P.y, P.z);
|
float4 rgba = kernel_tex_image_interp_3d(slot, P.x, P.y, P.z);
|
||||||
|
|
||||||
|
@@ -81,6 +81,7 @@ set(SRC_OSL
|
|||||||
node_wireframe.osl
|
node_wireframe.osl
|
||||||
node_hair_bsdf.osl
|
node_hair_bsdf.osl
|
||||||
node_uv_map.osl
|
node_uv_map.osl
|
||||||
|
node_rgb_to_bw.osl
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SRC_OSL_HEADERS
|
set(SRC_OSL_HEADERS
|
||||||
|
@@ -88,7 +88,7 @@ shader node_image_texture(
|
|||||||
string color_space = "sRGB",
|
string color_space = "sRGB",
|
||||||
string projection = "flat",
|
string projection = "flat",
|
||||||
string interpolation = "smartcubic",
|
string interpolation = "smartcubic",
|
||||||
string wrap = "periodic",
|
string extension = "periodic",
|
||||||
float projection_blend = 0.0,
|
float projection_blend = 0.0,
|
||||||
int is_float = 1,
|
int is_float = 1,
|
||||||
int use_alpha = 1,
|
int use_alpha = 1,
|
||||||
@@ -108,7 +108,7 @@ shader node_image_texture(
|
|||||||
use_alpha,
|
use_alpha,
|
||||||
is_float,
|
is_float,
|
||||||
interpolation,
|
interpolation,
|
||||||
wrap);
|
extension);
|
||||||
}
|
}
|
||||||
else if (projection == "box") {
|
else if (projection == "box") {
|
||||||
/* object space normal */
|
/* object space normal */
|
||||||
@@ -184,7 +184,7 @@ shader node_image_texture(
|
|||||||
use_alpha,
|
use_alpha,
|
||||||
is_float,
|
is_float,
|
||||||
interpolation,
|
interpolation,
|
||||||
wrap);
|
extension);
|
||||||
Alpha += weight[0] * tmp_alpha;
|
Alpha += weight[0] * tmp_alpha;
|
||||||
}
|
}
|
||||||
if (weight[1] > 0.0) {
|
if (weight[1] > 0.0) {
|
||||||
@@ -195,7 +195,7 @@ shader node_image_texture(
|
|||||||
use_alpha,
|
use_alpha,
|
||||||
is_float,
|
is_float,
|
||||||
interpolation,
|
interpolation,
|
||||||
wrap);
|
extension);
|
||||||
Alpha += weight[1] * tmp_alpha;
|
Alpha += weight[1] * tmp_alpha;
|
||||||
}
|
}
|
||||||
if (weight[2] > 0.0) {
|
if (weight[2] > 0.0) {
|
||||||
@@ -206,7 +206,7 @@ shader node_image_texture(
|
|||||||
use_alpha,
|
use_alpha,
|
||||||
is_float,
|
is_float,
|
||||||
interpolation,
|
interpolation,
|
||||||
wrap);
|
extension);
|
||||||
Alpha += weight[2] * tmp_alpha;
|
Alpha += weight[2] * tmp_alpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ shader node_image_texture(
|
|||||||
use_alpha,
|
use_alpha,
|
||||||
is_float,
|
is_float,
|
||||||
interpolation,
|
interpolation,
|
||||||
wrap);
|
extension);
|
||||||
}
|
}
|
||||||
else if (projection == "tube") {
|
else if (projection == "tube") {
|
||||||
point projected = map_to_tube(texco_remap_square(p));
|
point projected = map_to_tube(texco_remap_square(p));
|
||||||
@@ -230,6 +230,6 @@ shader node_image_texture(
|
|||||||
use_alpha,
|
use_alpha,
|
||||||
is_float,
|
is_float,
|
||||||
interpolation,
|
interpolation,
|
||||||
wrap);
|
extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
intern/cycles/kernel/shaders/node_rgb_to_bw.osl
Normal file
25
intern/cycles/kernel/shaders/node_rgb_to_bw.osl
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011-2013 Blender Foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdosl.h"
|
||||||
|
|
||||||
|
shader node_rgb_to_bw(
|
||||||
|
color Color = 0.0,
|
||||||
|
output float Val = 0.0)
|
||||||
|
{
|
||||||
|
Val = Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722;
|
||||||
|
}
|
||||||
|
|
@@ -1596,7 +1596,7 @@ void RGBToBWNode::compile(SVMCompiler& compiler)
|
|||||||
|
|
||||||
void RGBToBWNode::compile(OSLCompiler& compiler)
|
void RGBToBWNode::compile(OSLCompiler& compiler)
|
||||||
{
|
{
|
||||||
compiler.add(this, "node_convert_from_color");
|
compiler.add(this, "node_rgb_to_bw");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert */
|
/* Convert */
|
||||||
|
Reference in New Issue
Block a user