IZ_BOOL CBillboardZAxis::Init( izanagi::IMemoryAllocator* allocator, izanagi::graph::CGraphicsDevice* device) { m_Rect = izanagi::CDebugMeshRectangle::CreateDebugMeshRectangle( allocator, device, izanagi::E_DEBUG_MESH_VTX_FORM_POS | izanagi::E_DEBUG_MESH_VTX_FORM_COLOR, IZ_COLOR_RGBA(0x00, 0xff, 0x00, 0xff), 1, 1, 20.0f, 200.0f); m_Rect2 = izanagi::CDebugMeshRectangle::CreateDebugMeshRectangle( allocator, device, izanagi::E_DEBUG_MESH_VTX_FORM_POS | izanagi::E_DEBUG_MESH_VTX_FORM_COLOR, IZ_COLOR_RGBA(0x00, 0x00, 0xff, 0xff), 1, 1, 20.0f, 200.0f); izanagi::CFileInputStream in; in.Open("data/BasicShader.shd"); m_Shader = izanagi::shader::CShaderBasic::CreateShader<izanagi::shader::CShaderBasic>( allocator, device, &in); return IZ_TRUE; }
void DynamicStreamApp::createVertices() { static const IZ_COLOR colors[] = { IZ_COLOR_RGBA(0xff, 0, 0, 0xff), IZ_COLOR_RGBA(0, 0xff, 0, 0xff), IZ_COLOR_RGBA(0, 0, 0xff, 0xff), }; SYSTEMTIME st; GetSystemTime(&st); //izanagi::math::CMathRand::Init(st.wMilliseconds); izanagi::math::CMathRand::Init(0); IZ_UINT offset = 0; for (IZ_UINT i = 0; i < LIST_NUM; i++) { for (IZ_UINT n = 0; n < POINT_NUM; n++) { m_vtx[i][n].pos[0] = izanagi::math::CMathRand::GetRandFloat() * 100.0f; m_vtx[i][n].pos[1] = izanagi::math::CMathRand::GetRandFloat() * 100.0f; m_vtx[i][n].pos[2] = izanagi::math::CMathRand::GetRandFloat() * 100.0f; m_vtx[i][n].pos[3] = 1.0f; m_vtx[i][n].color = colors[n % COUNTOF(colors)]; } #ifdef ENABLE_TRHEAD m_items[i].offset = offset; offset += POINT_NUM; #endif } #ifdef ENABLE_TRHEAD m_thread = std::thread([&] { while (m_isRunThread) { for (IZ_UINT i = 0; i < LIST_NUM; i++) { if (!m_items[i].isRenderable && m_mappedDataPtr) { IZ_UINT8* dst = (IZ_UINT8*)m_mappedDataPtr; dst += m_items[i].offset * sizeof(Vertex); memcpy(dst, m_vtx[i], sizeof(m_vtx[i])); m_items[i].isRenderable = true; } } } }); #endif }
IZ_BOOL GBuffer::beginSSAOPass( izanagi::graph::CGraphicsDevice* device, izanagi::shader::CShaderBasic* shader) { shader->EnableToUpdateRenderState( izanagi::graph::E_GRAPH_RS_ZWRITEENABLE, IZ_FALSE); shader->EnableToUpdateRenderState( izanagi::graph::E_GRAPH_RS_ZENABLE, IZ_FALSE); device->SaveRenderState(); device->SetRenderState( izanagi::graph::E_GRAPH_RS_ZWRITEENABLE, IZ_FALSE); device->SetRenderState( izanagi::graph::E_GRAPH_RS_ZENABLE, IZ_FALSE); auto ret = device->BeginScene( &m_SSAOBuffer, 1, izanagi::graph::E_GRAPH_CLEAR_FLAG_COLOR, IZ_COLOR_RGBA(0x00, 0x00, 0x00, 0xff)); device->SetTexture(0, getBuffer(GBuffer::Type::Normal)); device->SetTexture(1, getBuffer(GBuffer::Type::Depth)); return ret; }
IZ_BOOL GBuffer::beginGeometryPass(izanagi::graph::CGraphicsDevice* device) { auto ret = device->BeginScene( m_buffers, COUNTOF(m_buffers), izanagi::graph::E_GRAPH_CLEAR_FLAG_ALL, IZ_COLOR_RGBA(0xff, 0xff, 0xff, 0x00)); return ret; }
// 開始 IZ_BOOL UpscaleGeometryRenderingApp::InitInternal( izanagi::IMemoryAllocator* allocator, izanagi::graph::CGraphicsDevice* device, izanagi::sample::CSampleCamera& camera) { IZ_BOOL result = IZ_TRUE; m_scene.init(allocator, device, camera); auto width = device->GetBackBufferWidth(); auto height = device->GetBackBufferHeight(); m_shdGeometryPass.init( device, "shader/vs_geometry.glsl", "shader/ps_geometry.glsl"); m_shdColorPass.init( device, "shader/vs_default.glsl", "shader/ps_default.glsl"); m_shdFinalPass.init( device, "shader/vs_fillscreen.glsl", "shader/ps_final.glsl"); m_gbuffer.init(allocator, device); m_screenFillPlane = izanagi::CDebugMeshScreenFillPlane::create( allocator, device, IZ_COLOR_RGBA(0xff, 0xff, 0xff, 0xff)); IZ_ASSERT(m_screenFillPlane != IZ_NULL); // カメラ camera.Init( izanagi::math::CVector4(0.0f, 0.0f, 30.0f, 1.0f), izanagi::math::CVector4(0.0f, 0.0f, 0.0f, 1.0f), izanagi::math::CVector4(0.0f, 1.0f, 0.0f, 1.0f), 1.0f, 500.0f, izanagi::math::CMath::Deg2Rad(60.0f), (IZ_FLOAT)device->GetBackBufferWidth() / device->GetBackBufferHeight()); camera.Update(); __EXIT__: if (!result) { ReleaseInternal(); } return result; }
// 開始 IZ_BOOL CStateBevelShader::Enter( izanagi::IMemoryAllocator* allocator, izanagi::graph::CGraphicsDevice* device, izanagi::CValue& arg) { IZ_BOOL result = IZ_TRUE; // シェーダ { izanagi::CFileInputStream in; VRETURN(in.Open("data/BevelShader.shd")); m_Shader = izanagi::shader::CShaderBasic::CreateShader<izanagi::shader::CShaderBasic>( allocator, device, &in); VGOTO(result = (m_Shader != IZ_NULL), __EXIT__); } // メッシュ { IZ_UINT flag = izanagi::E_DEBUG_MESH_VTX_FORM_POS | izanagi::E_DEBUG_MESH_VTX_FORM_NORMAL; m_Mesh = BevelShaderMesh::Create( allocator, device, flag, IZ_COLOR_RGBA(0xff, 0xff, 0xff, 0xff), 5.0f, 5.0f, 5.0f); VGOTO(result = (m_Mesh != IZ_NULL), __EXIT__); } __EXIT__: if (!result) { Leave(); } return result; }
void C2D::Render(izanagi::graph::CGraphicsDevice* device) { IZ_FLOAT value = m_EasingInterp->GetValue(m_Timeline); IZ_UINT8 alpha = value * 0xff; IZ_COLOR clr = IZ_COLOR_RGBA(0xff, 0xff, 0xff, alpha); device->Begin2D(); { device->SetTexture(0, m_Img->GetTexture(0)); device->Draw2DSprite( izanagi::CFloatRect(0.0f, 0.0f, 1.0f, 1.0f), izanagi::CIntRect(0, 720 - 312 + 100 - 100 * value, 1280, 312), clr); device->Draw2DSprite( izanagi::CFloatRect(1.0f, 1.0f, 0.0f, 0.0f), izanagi::CIntRect(0, -100 + value * 100, 1280, 312), clr); } device->End2D(); }
IZ_COLOR AppGalleryApp::GetBgColor() const { return IZ_COLOR_RGBA(0x00, 0x00, 0x00, 0xff); }
#include "Configure.h" const IZ_UINT Configure::SCREEN_WIDTH = 1280; const IZ_UINT Configure::SCREEN_HEIGHT = 720; const IZ_UINT Configure::PHOTOS = 90; const IZ_UINT Configure::MeshFlags = izanagi::E_DEBUG_MESH_VTX_FORM_POS | izanagi::E_DEBUG_MESH_VTX_FORM_COLOR | izanagi::E_DEBUG_MESH_VTX_FORM_NORMAL; const IZ_UINT Configure::Slices = 20; const IZ_COLOR Configure::DefaultColor = IZ_COLOR_RGBA(0xff, 0xff, 0xff, 0xff); const IZ_COLOR Configure::PhotoItemSideAndTopFaceColor = IZ_COLOR_RGBA(0x80, 0x80, 0x80, 0xff); const IZ_COLOR Configure::SeatColor = IZ_COLOR_RGBA(0x20, 0x20, 0x20, 0xff); const IZ_COLOR Configure::BGColor = IZ_COLOR_RGBA(0x20, 0x20, 0x20, 0xff); // Raduis. const IZ_FLOAT Configure::RadiusDiff = 10.0f; const IZ_FLOAT Configure::InnerRadius = 80.0f; const IZ_FLOAT Configure::MidRadius = Configure::InnerRadius + Configure::RadiusDiff; const IZ_FLOAT Configure::OuterRadius = Configure::MidRadius + Configure::RadiusDiff; const IZ_FLOAT Configure::CameraDistance = 30.0f; // Height. const IZ_FLOAT Configure::HeightPerFloor = 10.0f; const IZ_FLOAT Configure::SeatHeight = Configure::HeightPerFloor * 2.0f; const IZ_FLOAT Configure::Depth = 1.0f;