intermediate commit
parent
94affb09da
commit
455f59c4e1
|
@ -452,8 +452,6 @@ void CharacterEntity::UpdateIKConstraintSet() {
|
|||
mIKConstraintSet.lambda = 1.0e-3;
|
||||
mIKConstraintSet.max_steps = 2;
|
||||
mIKConstraintSet.step_tol = 1.0e-5;
|
||||
|
||||
mIKConstraintSet.Bind(*mRigModel);
|
||||
} else {
|
||||
for (int i = 0; i < mIKConstraints.size(); ++i) {
|
||||
const IKConstraint& constraint = mIKConstraints[i];
|
||||
|
@ -521,7 +519,7 @@ void CharacterEntity::ApplyIKConstraints() {
|
|||
void CharacterEntity::Update(float dt) {
|
||||
UpdateIKGizmos();
|
||||
ApplyCharacterController(dt);
|
||||
ApplyIKConstraints();
|
||||
// ApplyIKConstraints();
|
||||
UpdateBoneMatrices();
|
||||
|
||||
cur_time += dt;
|
||||
|
@ -575,6 +573,8 @@ void ShowCharacterPropertiesWindow (CharacterEntity* character) {
|
|||
character->Reset();
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Render", &character->mEntity->mDrawEntity);
|
||||
|
||||
ImGui::Protot::DragFloat4Normalized ("Offset Quat", offset_quat.data(),
|
||||
0.01f, -1.0f, 1.0f);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "Serializer.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace SimpleMath::GL;
|
||||
|
||||
typedef Matrix44f Matrix44f;
|
||||
typedef Vector4f Vector4f;
|
||||
|
@ -850,6 +851,33 @@ void Renderer::createGeometries() {
|
|||
plane_ibh = bgfx::createIndexBuffer(
|
||||
bgfx::makeRef(s_planeIndices, sizeof(s_planeIndices) )
|
||||
);
|
||||
|
||||
// debugBoneMesh.Merge(
|
||||
// *Mesh::sCreateCuboid (1., 1., 1.),
|
||||
// TranslateMat44(0.f, .0f, 0.5f)
|
||||
// );
|
||||
|
||||
Mesh* sphere = Mesh::sCreateUVSphere (4, 4, 0.1f);
|
||||
|
||||
debugBoneMesh.Merge(
|
||||
*sphere,
|
||||
TranslateMat44(0.f, .0f, 0.0f)
|
||||
);
|
||||
|
||||
debugBoneMesh.Merge(
|
||||
*sphere,
|
||||
TranslateMat44(0.f, .0f, 1.0f)
|
||||
);
|
||||
|
||||
Mesh* cuboid = Mesh::sCreateCuboid (0.1f, 0.1f, 1.0f);
|
||||
debugBoneMesh.Merge(
|
||||
*cuboid,
|
||||
TranslateMat44(0.f, .0f, 0.5f)
|
||||
);
|
||||
|
||||
delete sphere;
|
||||
debugBoneMesh.Update();
|
||||
delete cuboid;
|
||||
}
|
||||
|
||||
Path::~Path() {
|
||||
|
@ -1397,7 +1425,6 @@ void Renderer::paintGL() {
|
|||
// Floor.
|
||||
bx::mtxMul(lightMtx, mtxFloor, lights[0].mtxShadow);
|
||||
bgfx::setUniform(lights[0].u_lightMtx, lightMtx);
|
||||
bgfx::setUniform(lights[0].u_lightPos, lights[0].pos.data());
|
||||
|
||||
// Clear backbuffer and shadowmap framebuffer at beginning.
|
||||
bgfx::setViewClear(RenderState::Skybox
|
||||
|
@ -1475,7 +1502,6 @@ void Renderer::paintGL() {
|
|||
}
|
||||
|
||||
bgfx::setUniform(lights[0].u_lightMtx, lightMtx);
|
||||
bgfx::setUniform(lights[0].u_lightPos, lights[0].pos.data());
|
||||
bgfx::setUniform(u_color, Vector4f(1.f, 1.f, 1.f, 1.f).data(), 4);
|
||||
bgfx::setIndexBuffer(plane_ibh);
|
||||
bgfx::setVertexBuffer(plane_vbh);
|
||||
|
@ -1490,6 +1516,9 @@ void Renderer::paintGL() {
|
|||
|
||||
// render entities
|
||||
for (size_t i = 0; i < entities.size(); i++) {
|
||||
if (entities[i]->mDrawEntity == false)
|
||||
continue;
|
||||
|
||||
float mtxLightViewProjInv[16];
|
||||
float light_pos_world[3];
|
||||
|
||||
|
@ -1534,6 +1563,7 @@ void Renderer::paintGL() {
|
|||
entities[i]->mSkeletonMeshes.GetBoneMatrix(j).data()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// render debug information
|
||||
|
@ -1574,6 +1604,12 @@ void Renderer::paintGL() {
|
|||
bgfx::submit(st.m_viewId, st.m_program.program);
|
||||
}
|
||||
|
||||
// render debug skeletons
|
||||
for (size_t i = 0; i < entities.size(); i++) {
|
||||
debugBoneMesh.Submit(&s_renderStates[RenderState::Scene],
|
||||
entities[i]->mTransform.toMatrix().data());
|
||||
}
|
||||
|
||||
// debug commands
|
||||
bgfx::setUniform(u_color, Vector4f(1.0f, 1.0f, 1.0f, 1.f).data(), 4);
|
||||
|
||||
|
|
|
@ -313,6 +313,7 @@ struct Entity {
|
|||
Vector4f mColor;
|
||||
Skeleton mSkeleton;
|
||||
SkeletonMeshes mSkeletonMeshes;
|
||||
bool mDrawEntity = false;
|
||||
|
||||
Entity() :
|
||||
mColor (1.f, 1.f, 1.f, 1.f ),
|
||||
|
@ -393,6 +394,8 @@ struct Renderer {
|
|||
std::vector<Path> debugPaths;
|
||||
std::vector<DebugCommand> debugCommands;
|
||||
|
||||
Mesh debugBoneMesh;
|
||||
|
||||
uint16_t activeCameraIndex;
|
||||
|
||||
Renderer() :
|
||||
|
|
Loading…
Reference in New Issue