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
00026 namespace SH {
00027
00028 template<typename T, int N, typename T2>
00029 ShTexData<T, N, T2>::ShTexData(const ShTextureNodePtr& node, const ShGeneric<N, T2>& coords, bool indexed)
00030 {
00031 if (ShContext::current()->parsing()) {
00032 ShVariable tex_var(node);
00033 ShStatement stmt(*this, tex_var, indexed ? SH_OP_TEXI : SH_OP_TEX, coords);
00034 ShContext::current()->parsing()->tokenizer.blockList()->addStatement(stmt);
00035 } else {
00036 SH_DEBUG_WARN("Immediate mode texture lookup is not yet implemented.");
00037
00038 }
00039 }
00040
00041 template<typename T, int N, typename T2>
00042 ShTexData<T, N, T2>::ShTexData(const ShTextureNodePtr& node, const ShGeneric<N, T2>& coords,
00043 const ShGeneric<N, T2>& dx, const ShGeneric<N, T2>& dy)
00044 {
00045 if (ShContext::current()->parsing()) {
00046 ShVariable tex_var(node);
00047 ShStatement stmt(*this, SH_OP_TEXD, tex_var, coords, join(dx, dy));
00048 ShContext::current()->parsing()->tokenizer.blockList()->addStatement(stmt);
00049 } else {
00050 shError(ShScopeException("Cannot do derivative texture lookup in immediate mode"));
00051 }
00052 }
00053
00054 template<typename T, int N, typename T2>
00055 ShTexData<T, N, T2>& ShTexData<T, N, T2>::operator=(const T& a)
00056 {
00057 if (ShContext::current()->parsing()) {
00058 shError(ShScopeException("Cannot assign to a texture in retained mode"));
00059 } else {
00060 SH_DEBUG_WARN("Immediate mode texture assignment is not yet implemented.");
00061
00062 }
00063 return *this;
00064 }
00065
00066 }
00067
00068 #endif // SHTEXDATAIMPL_HPP