00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifndef SHTEXDATAIMPL_HPP
00021 #define SHTEXDATAIMPL_HPP
00022
00023 #include "ShTexData.hpp"
00024 #include "ShError.hpp"
00025 #include "ShContext.hpp"
00026
00027 namespace SH {
00028
00029 template<typename T, int N, typename T2>
00030 ShTexData<T, N, T2>::ShTexData(const ShTextureNodePtr& node, const ShGeneric<N, T2>& coords, bool indexed)
00031 {
00032 if (ShContext::current()->parsing()) {
00033 ShVariable tex_var(node);
00034 ShStatement stmt(*this, tex_var, indexed ? SH_OP_TEXI : SH_OP_TEX, coords);
00035 ShContext::current()->parsing()->tokenizer.blockList()->addStatement(stmt);
00036 } else {
00037 SH_DEBUG_WARN("Immediate mode texture lookup is not yet implemented.");
00038
00039 }
00040 }
00041
00042 template<typename T, int N, typename T2>
00043 ShTexData<T, N, T2>::ShTexData(const ShTextureNodePtr& node, const ShGeneric<N, T2>& coords,
00044 const ShGeneric<N, T2>& dx, const ShGeneric<N, T2>& dy)
00045 {
00046 if (ShContext::current()->parsing()) {
00047 ShVariable tex_var(node);
00048 ShStatement stmt(*this, SH_OP_TEXD, tex_var, coords, join(dx, dy));
00049 ShContext::current()->parsing()->tokenizer.blockList()->addStatement(stmt);
00050 } else {
00051 shError(ShScopeException("Cannot do derivative texture lookup in immediate mode"));
00052 }
00053 }
00054
00055 template<typename T, int N, typename T2>
00056 ShTexData<T, N, T2>& ShTexData<T, N, T2>::operator=(const T& a)
00057 {
00058 if (ShContext::current()->parsing()) {
00059 shError(ShScopeException("Cannot assign to a texture in retained mode"));
00060 } else {
00061 SH_DEBUG_WARN("Immediate mode texture assignment is not yet implemented.");
00062
00063 }
00064 return *this;
00065 }
00066
00067 }
00068
00069 #endif // SHTEXDATAIMPL_HPP