Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(248)

Unified Diff: src/liboslexec/opattribute.cpp

Issue 186244: iscameraray and isshadowray (Closed) Base URL: http://openshadinglanguage.googlecode.com/svn/trunk/
Patch Set: raylevel and isshadowray Created 14 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/liboslexec/master.cpp ('k') | src/liboslexec/oslops.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/liboslexec/opattribute.cpp
===================================================================
--- src/liboslexec/opattribute.cpp (revision 539)
+++ src/liboslexec/opattribute.cpp (working copy)
@@ -148,6 +148,47 @@
}
+
+DECLOP (OP_isshadowray)
+{
+ DASSERT (nargs == 1);
+ Symbol &Result (exec->sym (args[0]));
+ DASSERT (Result.typespec().is_int());
+ ShaderGlobals *globals = exec->context()->globals();
+
+ exec->adjust_varying (Result, false);
+ VaryingRef<int> result ((float *)Result.data(), Result.step());
+ if (result.is_uniform()) {
+ result[0] = globals->isshadowray;
+ } else {
+ for (int i = beginpoint; i < endpoint; ++i)
+ if (runflags[i])
+ result[i] = globals->isshadowray;
+ }
+}
+
+
+
+DECLOP (OP_iscameraray)
+{
+ DASSERT (nargs == 1);
+ Symbol &Result (exec->sym (args[0]));
+ DASSERT (Result.typespec().is_int());
+ ShaderGlobals *globals = exec->context()->globals();
+
+ exec->adjust_varying (Result, false);
+ VaryingRef<int> result ((float *)Result.data(), Result.step());
+ if (result.is_uniform()) {
+ result[0] = globals->iscameraray;
+ } else {
+ for (int i = beginpoint; i < endpoint; ++i)
+ if (runflags[i])
+ result[i] = globals->iscameraray;
+ }
+}
+
+
+
}; // namespace pvt
}; // namespace OSL
#ifdef OSL_NAMESPACE
« no previous file with comments | « src/liboslexec/master.cpp ('k') | src/liboslexec/oslops.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b