本文整理汇总了C++中TextureManager::init方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager::init方法的具体用法?C++ TextureManager::init怎么用?C++ TextureManager::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureManager
的用法示例。
在下文中一共展示了TextureManager::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initGL
/*************************************************
* OpenGL initialization
*************************************************/
static int initGL(WININFO *winInfo)
{
char errorString[MAX_ERROR_LENGTH + 1];
// Create openGL functions
for (int i=0; i<NUM_GL_NAMES; i++) glFP[i] = (GenFP)wglGetProcAddress(glnames[i]);
// Create and initialize the shader manager
if (shaderManager.init(errorString))
{
MessageBox(winInfo->hWnd, errorString, "Shader Manager Load", MB_OK);
return -1;
}
// Create and initialize everything needed for texture Management
if (textureManager.init(errorString))
{
MessageBox(winInfo->hWnd, errorString, "Texture Manager Load", MB_OK);
return -1;
}
// Create the text editor
if (editor.init(&shaderManager, &textureManager, errorString))
{
MessageBox(winInfo->hWnd, errorString, "Editor init", MB_OK);
return -1;
}
return 0;
}
示例2: Init
bool Projekt::Init()
{
if (!D3D11App::Init())
return false;
// Initialize effects, input layouts and texture manager
Effects::InitAll(mDirect3D->GetDevice());
InputLayouts::InitAll(mDirect3D->GetDevice());
mTextureMgr.init(mDirect3D->GetDevice());
// Initialize wireframe render state
D3D11_RASTERIZER_DESC wireFrameDesc;
ZeroMemory(&wireFrameDesc, sizeof(D3D11_RASTERIZER_DESC));
wireFrameDesc.FillMode = D3D11_FILL_WIREFRAME;
wireFrameDesc.CullMode = D3D11_CULL_BACK;
wireFrameDesc.FrontCounterClockwise = false;
wireFrameDesc.DepthClipEnable = true;
HR(mDirect3D->GetDevice()->CreateRasterizerState(&wireFrameDesc, &WireFrameRS));
//--------------------------------------------------------
// Create sky
//--------------------------------------------------------
mSky = new Sky(mDirect3D->GetDevice(), L"Data/Textures/snowcube1024.dds", 5000.0f);
//--------------------------------------------------------
// Create terrain
//--------------------------------------------------------
// Describe terrain
Terrain::InitInfo tInitInfo;
tInitInfo.HeightMapFilename = L"Data/Textures/Heightmaps/terrain.raw";
tInitInfo.LayerMapFilename0 = L"Data/Textures/grass.dds";
tInitInfo.LayerMapFilename1 = L"Data/Textures/darkdirt.dds";
tInitInfo.LayerMapFilename2 = L"Data/Textures/stone.dds";
tInitInfo.LayerMapFilename3 = L"Data/Textures/lightdirt.dds";
tInitInfo.LayerMapFilename4 = L"Data/Textures/snow.dds";
tInitInfo.BlendMapFilename = L"Data/Textures/blend.dds";
tInitInfo.HeightScale = 50.0f;
tInitInfo.HeightmapWidth = 2049;
tInitInfo.HeightmapHeight = 2049;
tInitInfo.CellSpacing = 0.5f;
// Initialize terrain
mTerrain.Init(mDirect3D->GetDevice(), mDirect3D->GetImmediateContext(), tInitInfo);
//--------------------------------------------------------
// Particle systems
//--------------------------------------------------------
mRandomTexSRV = d3dHelper::CreateRandomTexture1DSRV(mDirect3D->GetDevice());
std::vector<std::wstring> flares;
flares.push_back(L"Data\\Textures\\flare0.dds");
mFlareTexSRV = d3dHelper::CreateTexture2DArraySRV(mDirect3D->GetDevice(), mDirect3D->GetImmediateContext(), flares);
mFire.init(mDirect3D->GetDevice(), Effects::FireFX, mFlareTexSRV, mRandomTexSRV, 500);
mFire.setEmitPos(XMFLOAT3(65.0f, 5.0f, 0.0f));
//--------------------------------------------------------
// Create shadow map
//--------------------------------------------------------
mShadowMapSize = 2048;
mShadowMap = new ShadowMap(mDirect3D->GetDevice(), mShadowMapSize, mShadowMapSize);
//--------------------------------------------------------
// Load models
//--------------------------------------------------------
mGenericModel = new GenericModel(mDirect3D->GetDevice(), mTextureMgr, "Data\\Models\\Collada\\duck.dae", L"Data\\Models\\Collada\\");
//mSkinnedModel = new GenericSkinnedModel(mDirect3D->GetDevice(), mTextureMgr, "Data\\Models\\Collada\\AnimTest\\test_Collada_DAE.dae", L"Data\\Models\\Collada\\AnimTest\\");
mPlayerModel = new GenericModel(mDirect3D->GetDevice(), mTextureMgr, "Data\\Models\\OBJ\\Cop\\cop.obj", L"Data\\Models\\OBJ\\Cop\\");
Player::InitProperties playerProp;
playerProp.PlayerID = 0;
playerProp.Nickname = "Hyzor";
playerProp.Speed = 1.0f;
playerProp.Health = 1.0f;
playerProp.Position = XMFLOAT3(0.0f, 0.0f, 0.0f);
playerProp.Scale = XMFLOAT3(1.0f, 1.0f, 1.0f);
playerProp.Angle = 0.0f;
playerProp.Model = mPlayerModel;
mPlayer.Init(playerProp);
//--------------------------------------------------------
// Create model instances
//--------------------------------------------------------
GenericModelInstance genericInstance;
genericInstance.model = mGenericModel;
// GenericSkinnedModelInstance genSkinnedInstance;
// genSkinnedInstance.model = mSkinnedModel;
// genSkinnedInstance.FinalTransforms.resize(mSkinnedModel->skinnedData.getBoneCount());
// genSkinnedInstance.ClipName = "animation";
// genSkinnedInstance.TimePos = 0.0f;
//--------------------------------------------------------
// Scale, rotate and move model instances
//.........这里部分代码省略.........
示例3: initGL
/*************************************************
* OpenGL initialization
*************************************************/
static int initGL(WININFO *winInfo)
{
char errorString[MAX_ERROR_LENGTH + 1];
// Create openGL functions
for (int i=0; i<NUM_GL_NAMES; i++) glFP[i] = (GenFP)wglGetProcAddress(glnames[i]);
// NEHE MULTISAMPLE
bool arbMultisampleSupported = false;
int arbMultisampleFormat = 0;
// Get Our Pixel Format
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB =
(PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
HDC hDC = winInfo->hDC;
int pixelFormat;
int valid;
UINT numFormats;
float fAttributes[] = { 0,0 };
// These Attributes Are The Bits We Want To Test For In Our Sample
// Everything Is Pretty Standard, The Only One We Want To
// Really Focus On Is The SAMPLE BUFFERS ARB And WGL SAMPLES
// These Two Are Going To Do The Main Testing For Whether Or Not
// We Support Multisampling On This Hardware
int iAttributes[] = { WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
WGL_COLOR_BITS_ARB,24,
WGL_ALPHA_BITS_ARB,8,
WGL_DEPTH_BITS_ARB,0,
WGL_STENCIL_BITS_ARB,0,
WGL_DOUBLE_BUFFER_ARB,GL_TRUE,
WGL_SAMPLE_BUFFERS_ARB,GL_TRUE,
WGL_SAMPLES_ARB, 4, // Check For 4x Multisampling
0,0 };
// First We Check To See If We Can Get A Pixel Format For 4 Samples
valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
// if We Returned True, And Our Format Count Is Greater Than 1
if (valid && numFormats >= 1) {
arbMultisampleSupported = true;
arbMultisampleFormat = pixelFormat;
} else {
// Our Pixel Format With 4 Samples Failed, Test For 2 Samples
iAttributes[19] = 2;
valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
if (valid && numFormats >= 1) {
arbMultisampleSupported = true;
arbMultisampleFormat = pixelFormat;
}
}
if (arbMultisampleSupported) {
//SetPixelFormat(winInfo->hDC, arbMultisampleFormat, &pfd);
//wglMakeCurrent(winInfo->hDC, winInfo->hRC);
//DestroyWindow(winInfo->hWnd);
window_end(winInfo);
// Remove all messages...
MSG msg;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE));
window_init(winInfo, true, arbMultisampleFormat);
}
glEnable(GL_MULTISAMPLE_ARB);
// Create and initialize the shader manager
if (shaderManager.init(errorString))
{
MessageBox(winInfo->hWnd, errorString, "Shader Manager Load", MB_OK);
return -1;
}
// Create and initialize everything needed for texture Management
if (textureManager.init(errorString))
{
MessageBox(winInfo->hWnd, errorString, "Texture Manager Load", MB_OK);
return -1;
}
// Create the text editor
if (editor.init(&shaderManager, &textureManager, errorString))
{
MessageBox(winInfo->hWnd, errorString, "Editor init", MB_OK);
return -1;
}
blob = 0.;
// Create the fluid simulation stuff
//fluid_simulation_.Init(false);
return 0;
}