本文整理汇总了C++中ShaderLoader::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderLoader::Load方法的具体用法?C++ ShaderLoader::Load怎么用?C++ ShaderLoader::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderLoader
的用法示例。
在下文中一共展示了ShaderLoader::Load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
int init() {
// --- ezeket kell osszeszedni egy initwindowban
const int screenWidth = m_window.getRealWidth(), screenHeight = m_window.getRealHeight();
const int VSYNC_ENABLED = 1, FULL_SCREEN = 0;
this->render.Initialize(screenWidth, screenHeight, VSYNC_ENABLED, this->m_window.getHWnd(), FULL_SCREEN);
// init file loader
this->m_file_loader = new FileAssetFactory("./../../assets/rotating_cube/");
// --------------------------------------------------
// -- camera
m_camera = new Camera;
m_camera->SetPosition(0.0f, 0.0f, -10.0f);
// -- texture
TextureFromBitmap *textureLoader = new TextureFromBitmap("normap.jpg");
TextureResRef textureRes = (TextureRes*)textureLoader->NewResource();
textureLoader->Load(this, textureRes);
this->m_texture = textureRes->Get();
delete textureLoader;
// -- texture sampler
m_textureSampler = new TextureSampler();
m_textureSampler->Initialize(render);
// -- load shader
ShaderLoader *vShaderLoader = new ShaderLoader("vshader", "texture.hlsl", "TextureVertexShader", ST_Vertex);
ShaderResRef vShaderRef = (ShaderRes*)(vShaderLoader->NewResource());
vShaderLoader->Load(this, vShaderRef);
m_vertexShader = vShaderRef->Get();
delete vShaderLoader;
ShaderLoader *pShaderLoader = new ShaderLoader("pshader", "texture.hlsl", "TexturePixelShader", ST_Pixel);
ShaderResRef pShaderRef = (ShaderRes*)(pShaderLoader->NewResource());
pShaderLoader->Load(this, pShaderRef);
m_fragmentShader = pShaderRef->Get();
delete pShaderLoader;
// -- model
this->m_model = new Model;
// -- generator
SimpleMeshGenerator generator(render, m_vertexShader);
generator["POSITION"] = (void*)GrafkitData::cubeVertices;
generator["TEXCOORD"] = (void*)GrafkitData::cubeTextureUVs;
generator(GrafkitData::cubeVertexLength, GrafkitData::cubeIndicesLength, GrafkitData::cubeIndices, this->m_model);
// ---
this->t = 0;
return 0;
};