Example #1
0
        bool Shader::initFromFiles(const std::string& newPixelShader,
                                   const std::string& newVertexShader,
                                   uint32_t newVertexAttributes,
                                   const std::string& pixelShaderFunction,
                                   const std::string& vertexShaderFunction)
        {
            pixelShaderFilename = newPixelShader;
            vertexShaderFilename = newVertexShader;

            std::vector<uint8_t> pixelShaderData;

            if (!sharedEngine->getFileSystem()->loadFile(newPixelShader, pixelShaderData))
            {
                return false;
            }

            std::vector<uint8_t> vertexShaderData;

            if (!sharedEngine->getFileSystem()->loadFile(newVertexShader, vertexShaderData))
            {
                return false;
            }

            return initFromBuffers(pixelShaderData, vertexShaderData,
                                   newVertexAttributes, pixelShaderFunction, vertexShaderFunction);
        }
Example #2
0
        bool Shader::initFromFiles(const std::string& newPixelShader,
                                   const std::string& newVertexShader,
                                   uint32_t newVertexAttributes,
                                   const std::string& pixelShaderFunction,
                                   const std::string& vertexShaderFunction)
        {
            pixelShaderFilename = newPixelShader;
            vertexShaderFilename = newVertexShader;

            std::vector<uint8_t> pixelShaderData;

            if (!sharedEngine->getFileSystem()->loadFile(newPixelShader, pixelShaderData))
            {
                return false;
            }

            std::vector<uint8_t> vertexShaderData;

            if (!sharedEngine->getFileSystem()->loadFile(newVertexShader, vertexShaderData))
            {
                return false;
            }

            return initFromBuffers(reinterpret_cast<const uint8_t*>(pixelShaderData.data()), static_cast<uint32_t>(pixelShaderData.size()),
                                   reinterpret_cast<const uint8_t*>(vertexShaderData.data()), static_cast<uint32_t>(vertexShaderData.size()),
                                   newVertexAttributes, pixelShaderFunction, vertexShaderFunction);
        }