antispam-bee domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/ruwritingagame/public_html/wp-includes/functions.php on line 6170\u0417\u0434\u0435\u0441\u044c \u044f \u0445\u043e\u0447\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c “reflection” (\u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435) \u0438 “over mask” (\u0442\u0440\u0430\u0444\u0430\u0440\u0435\u0442) \u0448\u0435\u0439\u0434\u0435\u0440\u044b, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0434\u0432\u043e\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0435\u0439\u0434\u0435\u0440-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443<\/strong> \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432 \u0432 1 \u043f\u0440\u0438\u0441\u0435\u0441\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 – Phong <\/em>\u0438\u043b\u0438 flat <\/em>\u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445). \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 – flat, ucolor<\/em>, \u0431\u0435\u0437 \u0442\u0435\u043a\u0441\u0442\u0443\u0440).<\/p>\n\n\n\n \u0412\u044b\u0437\u043e\u0432 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n\n\n <\/p>\n\n\n\n \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c 4 \u0448\u0435\u0439\u0434\u0435\u0440-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u043c\u0438 defines:<\/p>\n\n\n\n \u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/strong>:<\/p>\n\n\n\n 1. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c VS, \u043e\u0442\u043a\u0440\u043e\u0435\u043c C:\\CPP\\a997modeler<\/em>\\p_windows\\p_windows.sln<\/em>.<\/p>\n\n\n\n \u041f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Shader<\/strong>.<\/p>\n\n\n\n 2. \u0417\u0430\u043c\u0435\u043d\u0438\u043c Shader.h<\/em> \u043a\u043e\u0434 \u043d\u0430<\/p>\n\n\n <\/p>\n\n\n\n 3. \u0417\u0430\u043c\u0435\u043d\u0438\u043c Shader.cpp<\/em> \u043a\u043e\u0434 \u043d\u0430<\/p>\n\n\n <\/p>\n\n\n\n \u0422\u0435\u043f\u0435\u0440\u044c – \u0441\u0430\u043c\u0438 \u0448\u0435\u0439\u0434\u0435\u0440\u044b.<\/p>\n\n\n\n 4. Vertex shader<\/strong>:<\/p>\n\n\n <\/p>\n\n\n\n \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 <\/strong>\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043a\u0430\u043a (overwrite)<\/p>\n\n\n\n C:\\CPP\\engine\\dt\\shaders\\phong_v<\/strong>.txt <\/em><\/p>\n\n\n\n <\/p>\n\n\n\n 5. Fragment shader<\/strong>:<\/p>\n\n\n <\/p>\n\n\n\n \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 <\/strong>\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043a\u0430\u043a (overwrite)<\/p>\n\n\n\n C:\\CPP\\engine\\dt\\shaders\\phong_f<\/strong>.txt <\/em><\/p>\n\n\n\n \u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f<\/strong>:<\/p>\n\n\n\n\nloadShadersGroup("phong", "PHONG; COLOR | TEXTURE; NONE | OVERMASK", pFLvertex->pData, pFLfragment->pData);\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#pragma once\n#include "platform.h"\n#include <string>\n#include <vector>\n\nclass Shader\n{\npublic:\n \/\/Shader program's individual descriptor:\n unsigned int GLid = -1; \/\/ GL shader id\n char shaderType[20] = "";\n \/\/common variables, "l_" for "location"\n \/\/attributes\n int l_aPos; \/\/attribute position (3D coordinates)\n int l_aTuv; \/\/attribute TUV (texture coordinates)\n int l_aTuv2; \/\/attribute TUV (texture coordinates for normal map)\n int l_aNormal; \/\/attribute normal (3D vector)\n int l_aTangent; \/\/for normal map\n int l_aBinormal; \/\/for normal map\n \/\/uniforms\n int l_uMVP; \/\/ transform matrix (Model-View-Projection)\n int l_uMV3x3; \/\/ Model-View matrix for normals\n int l_uVectorToLight; \/\/required for light\n int l_uHalfVector; \/\/required for specular light\n \/\/material's properties\n int l_uColor;\n int l_uTex0; \/\/texture id\n int l_uTex1mask; \/\/transparency map\n int l_uTex2nm; \/\/normal map\n int l_uTex3; \/\/texture id\n int l_uTex1alphaChannelN; \/\/alpha channel for mask\n int l_uTex1alphaNegative; \/\/alpha channel negative\n int l_uTex0translateChannelN; \/\/translate tex0 to tex3 by channelN.\n int l_uAlphaFactor; \/\/for semi-transparency\n int l_uAlphaBlending; \/\/for semi-transparency\n \/\/light:\n int l_uAmbient; \/\/ambient light\n \/\/specular light parameters\n int l_uSpecularIntencity;\n int l_uSpecularMinDot;\n int l_uSpecularPowerOf;\n \/\/end of descriptor\n\n \/\/static array (vector) of all loaded shaders\n static std::vector<Shader*> shaders;\n\npublic:\n static int loadShaders();\n static int cleanUp();\n static unsigned int getGLid(int shN) { return shaders.at(shN)->GLid; };\n static int shaderErrorCheck(int shaderId, std::string ref);\n static int programErrorCheck(int programId, std::string ref);\n static int fillLocations(Shader* pSh);\n\n static int buildShaderObjectFromFiles(std::string filePathVertexS, std::string filePathFragmentS);\n static int linkShaderProgramFromFiles(const char* filePathVertexS, const char* filePathFragmentS);\n\tstatic int compileShaderFromFile(const char* filePath, GLenum shaderType);\n\n static int buildShaderObjectWithDefines(std::string shaderType, std::string definesString, char* sourceVertex, char* sourceFragment);\n static int linkShaderProgramWithDefines(std::string definesString, char* sourceVertex, char* sourceFragment);\n static int compileShaderWithDefines(std::string definesString, char* shaderSource, GLenum shaderType);\n\n static int loadShadersGroup(std::string shaderType, std::string optionsString, char* sourceVertex, char* sourceFragment);\n};\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#include "Shader.h"\n#include "platform.h"\n#include "utils.h"\n#include "FileLoader.h"\n\nextern std::string filesRoot;\n\n\/\/static array (vector) of all loaded shaders\nstd::vector<Shader*> Shader::shaders;\n\nint Shader::loadShaders() {\n FileLoader* pFLvertex = new FileLoader("\/dt\/shaders\/phong_v.txt");\n FileLoader* pFLfragment = new FileLoader("\/dt\/shaders\/phong_f.txt");\n loadShadersGroup("flat", "FLAT; COLOR | TEXTURE; NONE | OVERMASK", pFLvertex->pData, pFLfragment->pData);\n loadShadersGroup("phong", "PHONG; COLOR | TEXTURE; NONE | OVERMASK", pFLvertex->pData, pFLfragment->pData);\n loadShadersGroup("mirror", "PHONG;MIRROR; NONE | OVERMASK", pFLvertex->pData, pFLfragment->pData);\n delete pFLvertex;\n delete pFLfragment;\n return 1;\n}\nint Shader::buildShaderObjectFromFiles(std::string filePathVertexS, std::string filePathFragmentS) {\n \/\/create shader object\n Shader* pSh = new Shader();\n shaders.push_back(pSh);\n pSh->GLid = linkShaderProgramFromFiles((filesRoot + filePathVertexS).c_str(), (filesRoot + filePathFragmentS).c_str());\n \/\/common variables. If not presented, = -1;\n fillLocations(pSh);\n\n return (shaders.size() - 1);\n}\nint Shader::fillLocations(Shader* pSh) {\n \/\/common variables. If not presented, = -1;\n \/\/attributes\n pSh->l_aPos = glGetAttribLocation(pSh->GLid, "aPos"); \/\/attribute position (3D coordinates)\n pSh->l_aNormal = glGetAttribLocation(pSh->GLid, "aNormal"); \/\/attribute normal (3D vector)\n pSh->l_aTangent = glGetAttribLocation(pSh->GLid, "aTangent"); \/\/for normal map\n pSh->l_aBinormal = glGetAttribLocation(pSh->GLid, "aBinormal"); \/\/for normal map\n pSh->l_aTuv = glGetAttribLocation(pSh->GLid, "aTuv"); \/\/attribute TUV (texture coordinates)\n pSh->l_aTuv2 = glGetAttribLocation(pSh->GLid, "aTuv2"); \/\/attribute TUV (texture coordinates)\n \/\/uniforms\n pSh->l_uMVP = glGetUniformLocation(pSh->GLid, "uMVP"); \/\/ transform matrix (Model-View-Projection)\n pSh->l_uMV3x3 = glGetUniformLocation(pSh->GLid, "uMV3x3"); \/\/ Model-View matrix for normals\n pSh->l_uVectorToLight = glGetUniformLocation(pSh->GLid, "uVectorToLight"); \/\/ \n pSh->l_uHalfVector = glGetUniformLocation(pSh->GLid, "uHalfVector"); \/\/ required for specular light\n \/\/material's properties\n pSh->l_uColor = glGetUniformLocation(pSh->GLid, "uColor");\n pSh->l_uTex0 = glGetUniformLocation(pSh->GLid, "uTex0"); \/\/texture id\n pSh->l_uTex1mask = glGetUniformLocation(pSh->GLid, "uTex1mask"); \/\/texture id\n pSh->l_uTex2nm = glGetUniformLocation(pSh->GLid, "uTex2nm"); \/\/texture id\n pSh->l_uTex3 = glGetUniformLocation(pSh->GLid, "uTex3"); \/\/texture id\n pSh->l_uTex1alphaChannelN = glGetUniformLocation(pSh->GLid, "uTex1alphaChannelN");\n pSh->l_uTex1alphaNegative = glGetUniformLocation(pSh->GLid, "uTex1alphaNegative");\n pSh->l_uTex0translateChannelN = glGetUniformLocation(pSh->GLid, "uTex0translateChannelN");\n pSh->l_uAlphaFactor = glGetUniformLocation(pSh->GLid, "uAlphaFactor"); \/\/ for semi-transparency\n pSh->l_uAlphaBlending = glGetUniformLocation(pSh->GLid, "uAlphaBlending"); \/\/ for semi-transparency\n pSh->l_uAmbient = glGetUniformLocation(pSh->GLid, "uAmbient"); \/\/ ambient light\n pSh->l_uSpecularIntencity = glGetUniformLocation(pSh->GLid, "uSpecularIntencity"); \/\/ \n pSh->l_uSpecularMinDot = glGetUniformLocation(pSh->GLid, "uSpecularMinDot"); \/\/ \n pSh->l_uSpecularPowerOf = glGetUniformLocation(pSh->GLid, "uSpecularPowerOf"); \/\/ \n return 1;\n}\nint Shader::cleanUp() {\n int shadersN = shaders.size();\n if (shadersN < 1)\n return -1;\n glUseProgram(0);\n for (int i = 0; i < shadersN; i++) {\n Shader* pSh = shaders.at(i);\n glDeleteProgram(pSh->GLid);\n delete pSh;\n }\n shaders.clear();\n return 1;\n}\n\nGLchar infoLog[1024];\nint logLength;\nint Shader::shaderErrorCheck(int shaderId, std::string ref) {\n \/\/use after glCompileShader()\n if (checkGLerrors(ref) > 0)\n return -1;\n glGetShaderInfoLog(shaderId, 1024, &logLength, infoLog);\n if (logLength == 0)\n return 0;\n mylog("%s shader infoLog:\\n%s\\n", ref.c_str(), infoLog);\n return -1;\n}\nint Shader::programErrorCheck(int programId, std::string ref) {\n \/\/use after glLinkProgram()\n if (checkGLerrors(ref) > 0)\n return -1;\n glGetProgramInfoLog(programId, 1024, &logLength, infoLog);\n if (logLength == 0)\n return 0;\n mylog("%s program infoLog:\\n%s\\n", ref.c_str(), infoLog);\n return -1;\n}\n\nint Shader::compileShaderFromFile(const char* filePath, GLenum shaderType) {\n int shaderId = glCreateShader(shaderType);\n FILE* pFile;\n myFopen_s(&pFile, filePath, "rt");\n if (pFile != NULL)\n {\n \/\/ obtain file size:\n fseek(pFile, 0, SEEK_END);\n int fSize = ftell(pFile);\n rewind(pFile);\n \/\/ size obtained, create buffer\n char* shaderSource = new char[fSize + 1];\n fSize = fread(shaderSource, 1, fSize, pFile);\n shaderSource[fSize] = 0;\n fclose(pFile);\n \/\/ source code loaded, compile\n glShaderSource(shaderId, 1, (const GLchar**)&shaderSource, NULL);\n \/\/myglErrorCheck("glShaderSource");\n glCompileShader(shaderId);\n if (shaderErrorCheck(shaderId, "glCompileShader") < 0)\n return -1;\n delete[] shaderSource;\n }\n else {\n mylog("ERROR loading %s\\n", filePath);\n return -1;\n }\n return shaderId;\n}\nint Shader::linkShaderProgramFromFiles(const char* filePathVertexS, const char* filePathFragmentS) {\n int vertexShaderId = compileShaderFromFile(filePathVertexS, GL_VERTEX_SHADER);\n int fragmentShaderId = compileShaderFromFile(filePathFragmentS, GL_FRAGMENT_SHADER);\n int programId = glCreateProgram();\n glAttachShader(programId, vertexShaderId);\n glAttachShader(programId, fragmentShaderId);\n glLinkProgram(programId);\n if (programErrorCheck(programId, "glLinkProgram") < 0)\n return -1;\n \/\/don't need shaders any longer - detach and delete them\n glDetachShader(programId, vertexShaderId);\n glDetachShader(programId, fragmentShaderId);\n glDeleteShader(vertexShaderId);\n glDeleteShader(fragmentShaderId);\n return programId;\n}\n\nint Shader::buildShaderObjectWithDefines(std::string shaderType, std::string definesString, char* sourceVertex, char* sourceFragment) {\n \/\/create shader object\n Shader* pSh = new Shader();\n shaders.push_back(pSh);\n myStrcpy_s(pSh->shaderType, 20, shaderType.c_str());\n\n pSh->GLid = linkShaderProgramWithDefines(definesString, sourceVertex, sourceFragment);\n \/\/common variables. If not presented, = -1;\n fillLocations(pSh);\n\n return (shaders.size() - 1);\n}\nint Shader::linkShaderProgramWithDefines(std::string definesString00, char* sourceVertex, char* sourceFragment) {\n \/\/build extended definesString\n bool bUSE_NORMALS = false;\n bool bUSE_TEX0 = false;\n bool bUSE_TUV0 = false;\n if (definesString00.find(" PHONG\\n") != std::string::npos)\n bUSE_NORMALS = true;\n if (definesString00.find(" TEXTURE\\n") != std::string::npos) {\n bUSE_TEX0 = true;\n bUSE_TUV0 = true;\n }\n if (definesString00.find(" MIRROR\\n") != std::string::npos) {\n bUSE_NORMALS = true;\n bUSE_TEX0 = true;\n }\n if (definesString00.find(" OVERMASK\\n") != std::string::npos) {\n bUSE_TUV0 = true;\n }\n std::string definesString;\n definesString.assign("#version 320 es\\n");\n definesString.append(definesString00);\n if (bUSE_NORMALS)\n definesString.append("#define USE_NORMALS\\n");\n if (bUSE_TEX0)\n definesString.append("#define USE_TEX0\\n");\n if (bUSE_TUV0)\n definesString.append("#define USE_TUV0\\n");\n\n int vertexShaderId = compileShaderWithDefines(definesString, sourceVertex, GL_VERTEX_SHADER);\n int fragmentShaderId = compileShaderWithDefines(definesString, sourceFragment, GL_FRAGMENT_SHADER);\n\n int programId = glCreateProgram();\n glAttachShader(programId, vertexShaderId);\n glAttachShader(programId, fragmentShaderId);\n glLinkProgram(programId);\n if (programErrorCheck(programId, "glLinkProgram") < 0)\n return -1;\n \/\/don't need shaders any longer - detach and delete them\n glDetachShader(programId, vertexShaderId);\n glDetachShader(programId, fragmentShaderId);\n glDeleteShader(vertexShaderId);\n glDeleteShader(fragmentShaderId);\n \/\/mylog("linking program\\n%s\\n", definesString.c_str());\n return programId;\n}\nint Shader::compileShaderWithDefines(std::string definesString, char* shaderSource, GLenum shaderType) {\n int shaderId = glCreateShader(shaderType);\n if (definesString.empty())\n glShaderSource(shaderId, 1, (const GLchar**)&shaderSource, NULL);\n else { \/\/2 strings\n const char* sourceStrings[2];\n sourceStrings[0] = definesString.c_str();\n sourceStrings[1] = shaderSource;\n \/\/ source code loaded, compile\n glShaderSource(shaderId, 2, (const GLchar**)sourceStrings, NULL);\n }\n \/\/myglErrorCheck("glShaderSource");\n glCompileShader(shaderId);\n if (shaderErrorCheck(shaderId, "glCompileShader") < 0) {\n mylog("ERROR in compileShader,\\n%s\\n%s\\n", definesString.c_str(), shaderSource);\n return -1;\n }\n return shaderId;\n}\n\nint Shader::loadShadersGroup(std::string shaderType, std::string optionsString, char* sourceVertex, char* sourceFragment) {\n struct Terms {\n std::vector<std::string> terms;\n int totalN = 0;\n int currentN = 0;\n };\n std::vector<Terms*> terms;\n std::vector<std::string> termGroups = splitString(optionsString, ";");\n int groupsN = termGroups.size();\n for (int groupN = 0; groupN < groupsN; groupN++) {\n Terms* pTerms = new Terms();\n terms.push_back(pTerms);\n pTerms->terms = splitString(termGroups.at(groupN), "|");\n pTerms->totalN = pTerms->terms.size();\n }\n while (1) {\n std::string definesString = "";\n for (int groupN = 0; groupN < groupsN; groupN++) {\n Terms* pTerms = terms.at(groupN);\n std::string term = pTerms->terms.at(pTerms->currentN);\n if (term.compare("NONE") != 0) {\n definesString.append("#define ");\n definesString.append(term);\n definesString.append("\\n");\n }\n }\n int shaderObjN = buildShaderObjectWithDefines(shaderType, definesString, sourceVertex, sourceFragment);\n \/\/go to next terms combo\n bool noMoreOptions = false;\n for (int groupN = groupsN - 1; groupN >= 0; groupN--) {\n Terms* pTerms = terms.at(groupN);\n if (pTerms->currentN < pTerms->totalN - 1) {\n pTerms->currentN++;\n break;\n }\n else { \/\/ the level exhausted\n pTerms->currentN = 0;\n \/\/proceed to upper level\n if (groupN == 0) {\n noMoreOptions = true;\n break;\n }\n }\n }\n if (noMoreOptions)\n break;\n }\n return 1;\n}\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n\/\/#version 320 es\nprecision lowp float;\nuniform mat4 uMVP; \/\/ transform matrix (Model-View-Projection)\nuniform mat3 uMV3x3; \/\/ Model-View matrix (for calculating normals into eye space)\n\nin vec3 aPos; \/\/ position attribute (x,y,z)\n#if defined(USE_NORMALS)\n\tin vec3 aNormal; \/\/ normal attribute (x,y,z)\n\tout vec3 vNormal; \/\/ varying normal (to pass to fragment shader)\n#endif\n#if defined(USE_TUV0)\n\tin vec2 aTuv; \/\/attribute TUV (texture coordinates)\n\tout vec2 vTuv; \/\/varying TUV (pass to fragment shader)\n#endif\n#if defined(MIRROR)\n\tout vec2 vTuvMirror; \/\/varying TUV (pass to fragment shader)\n#endif\n\nvoid main(void) { \n\tgl_Position = uMVP * vec4(aPos, 1.0);\n#if defined(USE_NORMALS)\t\n\t\/\/ Transform the normal's orientation into eye space. \n\tvNormal = uMV3x3 * aNormal;\t\n#endif\n#if defined(USE_TUV0)\n\tvTuv = aTuv;\n#endif\n#if defined(MIRROR)\n\tvTuvMirror[0] = (gl_Position[0]\/gl_Position[3]*0.1+vNormal[0]*0.4)+0.5;\n\tvTuvMirror[1] = -(gl_Position[1]\/gl_Position[3]*0.1+vNormal[1]*0.4)+0.5;\n#endif\n}\n\n<\/pre><\/div>\n\n\n
<\/p>\n\n\n\n
\n\n\n\n\n\/\/#version 320 es\nprecision lowp float;\nout vec4 FragColor; \/\/output pixel color\nuniform float uAlphaFactor; \/\/for semi-transparency\nuniform int uAlphaBlending; \/\/for semi-transparency\n\n#if defined(USE_NORMALS)\n\tin vec3 vNormal; \/\/normal passed from rasterizer\n#endif\n#if defined(USE_TEX0)\n\tuniform sampler2D uTex0; \/\/texture id\n\tuniform sampler2D uTex3; \/\/translate texture id\n\tuniform int uTex0translateChannelN;\n#else\n\tuniform vec4 uColor;\n#endif\n#if defined(USE_TUV0)\n\tin vec2 vTuv; \/\/varying TUV (passed from vertex shader)\n#endif\n#if defined(MIRROR)\n\tin vec2 vTuvMirror; \/\/varying TUV (passed from vertex shader)\n#endif\n#if defined(OVERMASK)\n\tuniform sampler2D uTex1mask; \/\/texture id\n\tuniform int uTex1alphaChannelN;\n\tuniform int uTex1alphaNegative;\n#endif\n\n#if defined(PHONG)\n\tuniform float uAmbient;\n\tuniform float uSpecularIntencity;\n\tuniform float uSpecularMinDot;\n\tuniform float uSpecularPowerOf;\n\n\tuniform vec3 uVectorToLight;\n\tuniform vec3 uHalfVector;\n#endif\n\nvoid main(void) {\n\n\tvec4 outColor;\n\tfloat alpha = 1.0;\n#if defined(OVERMASK)\n\toutColor = texture(uTex1mask, vTuv);\n\talpha = outColor[uTex1alphaChannelN];\n\tif(uTex1alphaNegative > 0)\n\t\talpha = 1.0 - alpha;\n\tif(alpha < 0.5){\n\t\tif(uAlphaBlending > 0){\n\t\t\tif(alpha == 0.0){\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\telse{ \/\/no AlphaBlending\n\t\t\tdiscard;\n\t\t\treturn;\n\t\t}\n\t}\n#endif\n#if defined(USE_TEX0)\n\t#if defined(MIRROR)\n\t\toutColor = texture(uTex0, vTuvMirror);\n\t#else\n\t\toutColor = texture(uTex0, vTuv);\n\t#endif\n\tif(uTex0translateChannelN >= 0){ \/\/translate channel\n\t\tvec2 tuv3;\n\t\ttuv3[0] = outColor[uTex0translateChannelN];\n\t\ttuv3[1] = 0.0;\n\t\toutColor = texture(uTex3, tuv3);\n\t}\n\tFragColor = outColor;\n#else\n\tFragColor = uColor;\n#endif\n\tif(FragColor.a != 1.0){\n\t\talpha *= FragColor.a;\n\t\tif(alpha < 0.5){\n\t\t\tif(uAlphaBlending > 0){\n\t\t\t\tif(alpha == 0.0){\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{ \/\/no AlphaBlending\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n#if defined(USE_NORMALS)\n\tvec3 vNormalNormal = normalize(vNormal);\n#endif\n\n#if defined(PHONG)\n\tif(uAmbient<1.0){\n\t\t \/\/ Calculate the dot product of the light vector and vertex normal. If the normal and light vector are\n\t\t \/\/ pointing in the same direction then it will get max illumination.\n\t\t float directionalLightIntencity = dot(vNormalNormal, uVectorToLight);\n\t\t\n\t\t \/\/ count ambient component\n\t\t directionalLightIntencity += uAmbient;\n\t\t if(directionalLightIntencity < uAmbient)\n\t\t\tdirectionalLightIntencity = uAmbient;\n\n\t\t \/\/ Multiply the color by the lightIntencity illumination level to get final output color.\n\t\t FragColor *= directionalLightIntencity;\n\t}\n\tif(uSpecularIntencity>0.0){\n\t\t\/\/specular light\n\t\t\/\/ INTENSITY OF THE SPECULAR LIGHT\n\t\t\/\/ DOT PRODUCT OF NORMAL VECTOR AND THE HALF VECTOR TO THE POWER OF THE SPECULAR HARDNESS\n\t\tfloat dotProduct = dot(vNormalNormal, uHalfVector);\n\n\t\tif(dotProduct>uSpecularMinDot){\n\t\t\tfloat specularIntencity = pow(dotProduct, uSpecularPowerOf) * uSpecularIntencity;\t\t\n\t\t\tif(specularIntencity > uSpecularIntencity)\n\t\t\t\tspecularIntencity = uSpecularIntencity;\n\t\t\tFragColor += specularIntencity;\n\t\t}\n\t}\n#endif\n\tif(uAlphaFactor != 1.0)\n\t\talpha *= uAlphaFactor;\t\n\tFragColor.a = alpha;\n}\n\n<\/pre><\/div>\n\n\n