Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/shaders/node_uv_map.osl
| Show All 11 Lines | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License | * limitations under the License | ||||
| */ | */ | ||||
| #include "stdosl.h" | #include "stdosl.h" | ||||
| shader node_uv_map( | shader node_uv_map( | ||||
| string name = "", | |||||
| int from_dupli = 0, | int from_dupli = 0, | ||||
| string name = "", | |||||
| string bump_offset = "center", | |||||
| output point UV = point(0.0, 0.0, 0.0)) | output point UV = point(0.0, 0.0, 0.0)) | ||||
| { | { | ||||
| if (from_dupli) { | if (from_dupli) { | ||||
| getattribute("geom:dupli_uv", UV); | getattribute("geom:dupli_uv", UV); | ||||
| } | } | ||||
| else { | else { | ||||
| if (name == "") | if (name == "") | ||||
| getattribute("geom:uv", UV); | getattribute("geom:uv", UV); | ||||
| else | else | ||||
| getattribute(name, UV); | getattribute(name, UV); | ||||
| } | } | ||||
| if (bump_offset == "dx") { | |||||
| if (!from_dupli) { | |||||
| UV += Dx(UV); | |||||
| } | |||||
| } | |||||
| else if (bump_offset == "dy") { | |||||
| if (!from_dupli) { | |||||
| UV += Dy(UV); | |||||
| } | |||||
| } | |||||
| } | } | ||||