本文整理汇总了C++中MeshBuilder::BuildPatch方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshBuilder::BuildPatch方法的具体用法?C++ MeshBuilder::BuildPatch怎么用?C++ MeshBuilder::BuildPatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshBuilder
的用法示例。
在下文中一共展示了MeshBuilder::BuildPatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//-----------------------------------------------------------------------------------
void TheGame::Update(float deltaTime)
{
DebugRenderer::instance->Update(deltaTime);
if (InputSystem::instance->WasKeyJustPressed(InputSystem::ExtraKeys::TILDE))
{
Console::instance->ActivateConsole();
}
if (Console::instance->IsActive())
{
return; //Don't do anything involving input updates.
}
UpdateCamera(deltaTime);
for (int i = 0; i < 16; i++)
{
m_lightPositions[i] = Vector3(sinf(static_cast<float>(GetCurrentTimeSeconds() + i)) * 5.0f, cosf(static_cast<float>(GetCurrentTimeSeconds() + i) / 2.0f) * 3.0f, 0.5f);
m_lights[i].SetPosition(m_lightPositions[i]);
m_currentMaterial->m_shaderProgram->SetVec3Uniform(Stringf("gLightPosition[%i]", i).c_str(), m_lightPositions[i], 16);
}
if (InputSystem::instance->WasKeyJustPressed('O'))
{
m_renderAxisLines = !m_renderAxisLines;
}
if (InputSystem::instance->WasKeyJustPressed('1'))
{
MeshBuilder builder;
MeshBuilder::PlaneData* data = new MeshBuilder::PlaneData(Vector3::ZERO, Vector3::RIGHT, Vector3::UP);
builder.BuildPatch(-5.0f, 5.0f, 50, -5.0f, 5.0f, 50,
[](const void* userData, float x, float y)
{
MeshBuilder::PlaneData const *plane = (MeshBuilder::PlaneData const*)userData;
Vector3 position = plane->initialPosition
+ (plane->right * x)
+ (plane->up * y);
return position;
}
, data);
builder.CopyToMesh(loadedMesh->m_mesh, &Vertex_SkinnedPCTN::Copy, sizeof(Vertex_SkinnedPCTN), &Vertex_SkinnedPCTN::BindMeshToVAO);
spinFactor = 0.0f;
}
if (InputSystem::instance->WasKeyJustPressed('2'))
{
MeshBuilder builder;
MeshBuilder::PlaneData* data = new MeshBuilder::PlaneData(Vector3::ZERO, Vector3::RIGHT, Vector3::UP);
builder.BuildPatch(-5.0f, 5.0f, 50, -5.0f, 5.0f, 50,
[](const void* userData, float x, float y)
{
MeshBuilder::PlaneData const *plane = (MeshBuilder::PlaneData const*)userData;
Vector3 position = plane->initialPosition
+ (plane->right * x)
+ (plane->up * y);
position.z = sin(x + y);
return position;
}
, data);
builder.CopyToMesh(loadedMesh->m_mesh, &Vertex_SkinnedPCTN::Copy, sizeof(Vertex_SkinnedPCTN), &Vertex_SkinnedPCTN::BindMeshToVAO);
spinFactor = 0.0f;
}
if (InputSystem::instance->WasKeyJustPressed('3'))
{
MeshBuilder builder;
MeshBuilder::PlaneData* data = new MeshBuilder::PlaneData(Vector3::ZERO, Vector3::RIGHT, Vector3::UP);
builder.BuildPatch(-5.0f, 5.0f, 50, -5.0f, 5.0f, 50,
[](const void* userData, float x, float y)
{
MeshBuilder::PlaneData const *plane = (MeshBuilder::PlaneData const*)userData;
Vector3 position = plane->initialPosition
+ (plane->right * x)
+ (plane->up * y);
position.z = .05f * -cos(((float)GetCurrentTimeSeconds() * 4.0f) + (Vector2(x, y).CalculateMagnitude() * 100.0f));
return position;
}
, data);
builder.CopyToMesh(loadedMesh->m_mesh, &Vertex_SkinnedPCTN::Copy, sizeof(Vertex_SkinnedPCTN), &Vertex_SkinnedPCTN::BindMeshToVAO);
spinFactor = 0.0f;
}
if (InputSystem::instance->WasKeyJustPressed('4'))
{
FbxListScene("Data/FBX/SampleBox.fbx");
}
if (InputSystem::instance->WasKeyJustPressed('5'))
{
Console::instance->RunCommand("fbxLoad Data/FBX/unitychan.fbx");
}
if (InputSystem::instance->WasKeyJustPressed('6'))
{
Console::instance->RunCommand("fbxLoad Data/FBX/samplebox.fbx");
}
if (InputSystem::instance->WasKeyJustPressed('7'))
{
Console::instance->RunCommand("saveMesh saveFile.picomesh");
}
if (InputSystem::instance->WasKeyJustPressed('8'))
{
Console::instance->RunCommand("loadMesh saveFile.picomesh");
}
if (g_loadedMesh != nullptr)
//.........这里部分代码省略.........