@@ -65,24 +65,30 @@ GFXShader* ShaderData::getShader()
65
65
66
66
StringTableEntry ShaderData::getVertexShaderPath ()
67
67
{
68
- if (DXVertexShaderName[0 ] != ' .' )
69
- return DXVertexShaderName;
70
- char fullFilename[128 ];
71
- dStrncpy (fullFilename, mPath , dStrlen (mPath ) + 1 );
72
- dStrcat (fullFilename, DXVertexShaderName);
68
+ if (dStrlen (DXVertexShaderName) > 1 && DXVertexShaderName[0 ] == ' .' && (DXVertexShaderName[1 ] == ' /' || DXVertexShaderName[1 ] == ' \\ ' ))
69
+ {
70
+ char fullFilename[128 ];
71
+ dStrncpy (fullFilename, mPath , dStrlen (mPath ) + 1 );
72
+ dStrcat (fullFilename, DXVertexShaderName + 2 );
73
+
74
+ return StringTable->insert (fullFilename);
75
+ }
73
76
74
- return StringTable-> insert (fullFilename) ;
77
+ return DXVertexShaderName ;
75
78
}
76
79
77
80
StringTableEntry ShaderData::getPixelShaderPath ()
78
81
{
79
- if (DXPixelShaderName[0 ] != ' .' )
80
- return DXPixelShaderName;
81
- char fullFilename[128 ];
82
- dStrncpy (fullFilename, mPath , dStrlen (mPath ) + 1 );
83
- dStrcat (fullFilename, DXPixelShaderName);
82
+ if (dStrlen (DXPixelShaderName) > 1 && DXPixelShaderName[0 ] == ' .' && (DXPixelShaderName[1 ] == ' /' || DXPixelShaderName[1 ] == ' \\ ' ))
83
+ {
84
+ char fullFilename[128 ];
85
+ dStrncpy (fullFilename, mPath , dStrlen (mPath ) + 1 );
86
+ dStrcat (fullFilename, DXPixelShaderName + 2 );
87
+
88
+ return StringTable->insert (fullFilename);
89
+ }
84
90
85
- return StringTable-> insert (fullFilename) ;
91
+ return DXPixelShaderName ;
86
92
}
87
93
88
94
bool ShaderData::onAdd ()
@@ -123,17 +129,17 @@ bool ShaderData::initShader()
123
129
const char * vtexShaderPath = DXVertexShaderName;
124
130
const char * pixelShaderPath = DXPixelShaderName;
125
131
126
- if (vtexShaderPath != NULL && vtexShaderPath[0 ] == ' .' )
132
+ if (vtexShaderPath != NULL && dStrlen ( vtexShaderPath) > 1 && vtexShaderPath [0 ] == ' .' && (vtexShaderPath[ 1 ] == ' / ' || vtexShaderPath[ 1 ] == ' \\ ' ) )
127
133
{
128
134
dStrncpy (fullFilename1, mPath , dStrlen (mPath ) + 1 );
129
- dStrcat (fullFilename1, vtexShaderPath);
135
+ dStrcat (fullFilename1, vtexShaderPath + 2 );
130
136
vtexShaderPath = fullFilename1;
131
137
}
132
138
133
- if (pixelShaderPath != NULL && pixelShaderPath[0 ] == ' .' )
139
+ if (pixelShaderPath != NULL && dStrlen ( pixelShaderPath) > 1 && pixelShaderPath [0 ] == ' .' && (pixelShaderPath[ 1 ] == ' / ' || pixelShaderPath[ 1 ] == ' \\ ' ) )
134
140
{
135
141
dStrncpy (fullFilename2, mPath , dStrlen (mPath ) + 1 );
136
- dStrcat (fullFilename2, pixelShaderPath);
142
+ dStrcat (fullFilename2, pixelShaderPath + 2 );
137
143
pixelShaderPath = fullFilename2;
138
144
}
139
145
0 commit comments