Patch
This commit is contained in:
@@ -43,6 +43,7 @@ vec3 CalcPhongLighting( vec3 worldPos, vec3 normal, vec3 lightPos ) {
|
|||||||
void main() {
|
void main() {
|
||||||
v_position = vec3( u_modelMatrix * vec4(a_position, 1.0) );
|
v_position = vec3( u_modelMatrix * vec4(a_position, 1.0) );
|
||||||
v_normal = vec3( mat3(u_modelMatrix) * a_normal );
|
v_normal = vec3( mat3(u_modelMatrix) * a_normal );
|
||||||
|
v_normal = normalize(v_normal);
|
||||||
v_texcoord = a_texcoord;
|
v_texcoord = a_texcoord;
|
||||||
|
|
||||||
v_finalColor = CalcPhongLighting( v_position, v_normal, u_ligthPosition );
|
v_finalColor = CalcPhongLighting( v_position, v_normal, u_ligthPosition );
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ void main() {
|
|||||||
v_position = vec3( u_modelMatrix * vec4( v_position, 1.0 ) );
|
v_position = vec3( u_modelMatrix * vec4( v_position, 1.0 ) );
|
||||||
|
|
||||||
v_normal = vec3( mat3(u_modelMatrix) * a_normal );
|
v_normal = vec3( mat3(u_modelMatrix) * a_normal );
|
||||||
|
v_normal = normalize(v_normal);
|
||||||
v_texcoord = a_texcoord;
|
v_texcoord = a_texcoord;
|
||||||
|
|
||||||
v_finalColor = CalcPhongLighting( v_position, v_normal, u_ligthPosition );
|
v_finalColor = CalcPhongLighting( v_position, v_normal, u_ligthPosition );
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ EMovementDir_Left = 8
|
|||||||
EMovementDir_Right = 16
|
EMovementDir_Right = 16
|
||||||
EMovementDir_Jump = 32
|
EMovementDir_Jump = 32
|
||||||
|
|
||||||
|
PhysicsFilter_None = 64
|
||||||
|
PhysicsFilter_Player = 128
|
||||||
|
PhysicsFilter_Triggers = 256
|
||||||
|
PhysicsFilter_Usable = 512
|
||||||
|
PhysicsFilter_NPC = 1024
|
||||||
|
PhysicsFilter_Obstacle = 2048
|
||||||
|
kPhysicsFilter_AllAux = PhysicsFilter_Player | PhysicsFilter_Triggers | PhysicsFilter_Usable
|
||||||
|
|
||||||
|
|
||||||
engine.error(string message)
|
engine.error(string message)
|
||||||
engine.warning(string message)
|
engine.warning(string message)
|
||||||
engine.create_entity(string classname) -- return an table to the new entity
|
engine.create_entity(string classname) -- return an table to the new entity
|
||||||
@@ -88,6 +97,10 @@ has_rigid_body() -- return boolean
|
|||||||
create_box_body(float sizex, float sizey, float sizez, float mass, float friction, float damping, bool is_trigger, bool use_parameters)
|
create_box_body(float sizex, float sizey, float sizez, float mass, float friction, float damping, bool is_trigger, bool use_parameters)
|
||||||
create_sphere_body(float radius, float mass, float friction, float damping, bool is_trigger, bool use_parameters)
|
create_sphere_body(float radius, float mass, float friction, float damping, bool is_trigger, bool use_parameters)
|
||||||
ForceBodyTransformUpdate() -- hack for forcing entity world transform to the rigid body
|
ForceBodyTransformUpdate() -- hack for forcing entity world transform to the rigid body
|
||||||
|
set_body_filter_group(integer group) -- set an physics group to the body
|
||||||
|
set_body_filter_mask(integer mask) -- set an physics group to the body
|
||||||
|
get_body_filter_group() -- return an current body group
|
||||||
|
get_body_filter_mask() -- return an current body mask
|
||||||
|
|
||||||
|
|
||||||
find_animation(string name) -- find an animation in the model
|
find_animation(string name) -- find an animation in the model
|
||||||
@@ -103,12 +116,13 @@ ActorBase methods:
|
|||||||
activate_camera()
|
activate_camera()
|
||||||
update_camera_look()
|
update_camera_look()
|
||||||
update_camera_movement(float nubmer)
|
update_camera_movement(float nubmer)
|
||||||
create_player_body()
|
|
||||||
update_body_movement(float nubmer)
|
update_body_movement(float nubmer)
|
||||||
get_action() -- return a current action mode (ACTION_FIRE, ACTION_ALT_FIRE, ACTION_RELOAD, ACTION_USE)
|
get_action() -- return a current action mode (ACTION_FIRE, ACTION_ALT_FIRE, ACTION_RELOAD, ACTION_USE)
|
||||||
get_movement() -- return a current movement mode (EMovementDir_None, ...)
|
get_movement() -- return a current movement mode (EMovementDir_None, ...)
|
||||||
on_ground() -- return boolean
|
on_ground() -- return boolean
|
||||||
is_noclip() -- return boolean
|
is_noclip() -- return boolean
|
||||||
|
create_player_body(float radius, float height, float mass, float friction, float damping)
|
||||||
|
create_player_body_box(float x, float y, float z, float mass, float friction, float damping)
|
||||||
|
|
||||||
|
|
||||||
Light methods:
|
Light methods:
|
||||||
|
|||||||
@@ -10,6 +10,18 @@ struct StaticMeshVertex;
|
|||||||
class RigidBody;
|
class RigidBody;
|
||||||
class IEntityBase;
|
class IEntityBase;
|
||||||
|
|
||||||
|
enum PhysicsFilter
|
||||||
|
{
|
||||||
|
PhysicsFilter_None = 1 << 6,
|
||||||
|
PhysicsFilter_Player = 1 << 7,
|
||||||
|
PhysicsFilter_Triggers = 1 << 8,
|
||||||
|
PhysicsFilter_Usable = 1 << 9,
|
||||||
|
PhysicsFilter_NPC = 1 << 10,
|
||||||
|
PhysicsFilter_Obstacle = 1 << 11,
|
||||||
|
};
|
||||||
|
|
||||||
|
const int kPhysicsFilter_AllAux = PhysicsFilter_Player | PhysicsFilter_Triggers | PhysicsFilter_Usable;
|
||||||
|
|
||||||
struct SceneCollisionModel
|
struct SceneCollisionModel
|
||||||
{
|
{
|
||||||
btCollisionObject* object;
|
btCollisionObject* object;
|
||||||
|
|||||||
@@ -2,22 +2,12 @@
|
|||||||
#define RIGIDBODYCOMPONENT_H
|
#define RIGIDBODYCOMPONENT_H
|
||||||
|
|
||||||
#include "engine/physics/bullet_private.h"
|
#include "engine/physics/bullet_private.h"
|
||||||
|
#include "engine/physics/physicsworld.h"
|
||||||
|
|
||||||
class PhysicsManager;
|
class PhysicsManager;
|
||||||
class PhysicsWorld;
|
class PhysicsWorld;
|
||||||
class ShapeComponent;
|
class ShapeComponent;
|
||||||
|
|
||||||
enum PhysicsFilter
|
|
||||||
{
|
|
||||||
PhysicsFilter_None = 1 << 6,
|
|
||||||
PhysicsFilter_Player = 1 << 7,
|
|
||||||
PhysicsFilter_Triggers = 1 << 8,
|
|
||||||
PhysicsFilter_Usable = 1 << 9,
|
|
||||||
PhysicsFilter_NPC = 1 << 9,
|
|
||||||
PhysicsFilter_Obstacle = 1 << 9,
|
|
||||||
};
|
|
||||||
|
|
||||||
const int kPhysicsFilter_AllAux = PhysicsFilter_Player | PhysicsFilter_Triggers | PhysicsFilter_Usable;
|
|
||||||
|
|
||||||
//! Rigid body
|
//! Rigid body
|
||||||
class RigidBody
|
class RigidBody
|
||||||
|
|||||||
@@ -184,6 +184,45 @@ void ActorBase::CreatePlayerBody(float radius, float height, float mass, float f
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActorBase::CreatePlayerBodyBox(float x, float y, float z, float mass, float friction, float damping)
|
||||||
|
{
|
||||||
|
m_shape = new btBoxShape(btVector3(x, y, z));
|
||||||
|
|
||||||
|
m_mass = mass;
|
||||||
|
btVector3 local_inertia(0.0f, 0.0f, 0.0f);
|
||||||
|
if (m_mass > 0.f) {
|
||||||
|
m_shape->calculateLocalInertia(m_mass, local_inertia);
|
||||||
|
}
|
||||||
|
|
||||||
|
btRigidBody::btRigidBodyConstructionInfo rigid_body_ci(m_mass, nullptr, m_shape, local_inertia);
|
||||||
|
|
||||||
|
m_rigidBody = new btRigidBody(rigid_body_ci);
|
||||||
|
m_rigidBody->setUserPointer(this);
|
||||||
|
m_rigidBody->setMotionState(&m_ph_motion_state);
|
||||||
|
m_ph_motion_state.setBody(m_rigidBody);
|
||||||
|
|
||||||
|
// I'm sure that position is valid
|
||||||
|
btTransform xform;
|
||||||
|
xform.setIdentity();
|
||||||
|
xform.setOrigin(glmVectorToBt(m_position));
|
||||||
|
m_rigidBody->setWorldTransform(xform);
|
||||||
|
|
||||||
|
// ACTOR STUFF
|
||||||
|
m_rigidBody->setAngularFactor(btVector3(0.0f, 0.0f, 0.0f));
|
||||||
|
|
||||||
|
m_rigidBody->setFriction(friction);
|
||||||
|
m_rigidBody->setAnisotropicFriction(btVector3(0.0f, 0.0f, 0.0f));
|
||||||
|
m_rigidBody->setDamping(damping, 0.0f);
|
||||||
|
|
||||||
|
m_rigidBody->setActivationState(DISABLE_DEACTIVATION);
|
||||||
|
|
||||||
|
// #TODO: body filter and mask
|
||||||
|
g_PhysicsWorld->GetWorld()->addRigidBody(m_rigidBody);
|
||||||
|
|
||||||
|
m_bodyDirty = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ActorBase::CreatePlayerBody_Old()
|
void ActorBase::CreatePlayerBody_Old()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -288,6 +327,7 @@ void ActorBase::RegisterFunctions()
|
|||||||
m_luaObject.Register("update_camera_movement", *this, &ActorBase::Lua_UpdateCameraMovement);
|
m_luaObject.Register("update_camera_movement", *this, &ActorBase::Lua_UpdateCameraMovement);
|
||||||
m_luaObject.Register("create_player_body", *this, &ActorBase::Lua_CreatePlayerBody);
|
m_luaObject.Register("create_player_body", *this, &ActorBase::Lua_CreatePlayerBody);
|
||||||
m_luaObject.Register("create_player_body_old", *this, &ActorBase::Lua_CreatePlayerBodyOld);
|
m_luaObject.Register("create_player_body_old", *this, &ActorBase::Lua_CreatePlayerBodyOld);
|
||||||
|
m_luaObject.Register("create_player_body_box", *this, &ActorBase::Lua_CreatePlayerBodyBox);
|
||||||
m_luaObject.Register("update_body_movement", *this, &ActorBase::Lua_UpdateBodyMovement);
|
m_luaObject.Register("update_body_movement", *this, &ActorBase::Lua_UpdateBodyMovement);
|
||||||
m_luaObject.Register("get_action", *this, &ActorBase::Lua_GetAction);
|
m_luaObject.Register("get_action", *this, &ActorBase::Lua_GetAction);
|
||||||
m_luaObject.Register("get_movement", *this, &ActorBase::Lua_GetMovement);
|
m_luaObject.Register("get_movement", *this, &ActorBase::Lua_GetMovement);
|
||||||
@@ -350,6 +390,21 @@ int ActorBase::Lua_CreatePlayerBodyOld(LuaPlus::LuaState* state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ActorBase::Lua_CreatePlayerBodyBox(LuaPlus::LuaState* state)
|
||||||
|
{
|
||||||
|
LuaPlus::LuaStack stack(state);
|
||||||
|
|
||||||
|
float x = (float)stack[2].GetNumber();
|
||||||
|
float y = (float)stack[3].GetNumber();
|
||||||
|
float z = (float)stack[4].GetNumber();
|
||||||
|
float mass = (float)stack[5].GetNumber();
|
||||||
|
float friction = (float)stack[6].GetNumber();
|
||||||
|
float damping = (float)stack[7].GetNumber();
|
||||||
|
|
||||||
|
CreatePlayerBodyBox(x, y, z, mass, friction, damping);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ActorBase::Lua_GetAction(LuaPlus::LuaState* state)
|
int ActorBase::Lua_GetAction(LuaPlus::LuaState* state)
|
||||||
{
|
{
|
||||||
int action = GenAction();
|
int action = GenAction();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public:
|
|||||||
void ActivateCamera();
|
void ActivateCamera();
|
||||||
|
|
||||||
void CreatePlayerBody(float radius, float height, float mass, float friction, float damping);
|
void CreatePlayerBody(float radius, float height, float mass, float friction, float damping);
|
||||||
|
void CreatePlayerBodyBox(float x, float y, float z, float mass, float friction, float damping);
|
||||||
void CreatePlayerBody_Old();
|
void CreatePlayerBody_Old();
|
||||||
|
|
||||||
bool OnGround();
|
bool OnGround();
|
||||||
@@ -49,6 +50,7 @@ public:
|
|||||||
int Lua_ActivateCamera(LuaPlus::LuaState* state);
|
int Lua_ActivateCamera(LuaPlus::LuaState* state);
|
||||||
int Lua_CreatePlayerBody(LuaPlus::LuaState* state);
|
int Lua_CreatePlayerBody(LuaPlus::LuaState* state);
|
||||||
int Lua_CreatePlayerBodyOld(LuaPlus::LuaState* state);
|
int Lua_CreatePlayerBodyOld(LuaPlus::LuaState* state);
|
||||||
|
int Lua_CreatePlayerBodyBox(LuaPlus::LuaState* state);
|
||||||
int Lua_GetAction(LuaPlus::LuaState* state);
|
int Lua_GetAction(LuaPlus::LuaState* state);
|
||||||
int Lua_GetMovement(LuaPlus::LuaState* state);
|
int Lua_GetMovement(LuaPlus::LuaState* state);
|
||||||
int Lua_OnGround(LuaPlus::LuaState* state);
|
int Lua_OnGround(LuaPlus::LuaState* state);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "scenemanager.h"
|
#include "scenemanager.h"
|
||||||
#include "game_world_objects.h"
|
#include "game_world_objects.h"
|
||||||
#include "actor_base.h"
|
#include "actor_base.h"
|
||||||
|
#include "physics/physicsworld.h"
|
||||||
|
|
||||||
#include <pugixml.hpp>
|
#include <pugixml.hpp>
|
||||||
|
|
||||||
@@ -236,6 +237,15 @@ void registerEngine()
|
|||||||
REGISTER_CONSTANT(EMovementDir_Right);
|
REGISTER_CONSTANT(EMovementDir_Right);
|
||||||
REGISTER_CONSTANT(EMovementDir_Jump);
|
REGISTER_CONSTANT(EMovementDir_Jump);
|
||||||
|
|
||||||
|
// Physics
|
||||||
|
REGISTER_CONSTANT(PhysicsFilter_None);
|
||||||
|
REGISTER_CONSTANT(PhysicsFilter_Player);
|
||||||
|
REGISTER_CONSTANT(PhysicsFilter_Triggers);
|
||||||
|
REGISTER_CONSTANT(PhysicsFilter_Usable);
|
||||||
|
REGISTER_CONSTANT(PhysicsFilter_NPC);
|
||||||
|
REGISTER_CONSTANT(PhysicsFilter_Obstacle);
|
||||||
|
REGISTER_CONSTANT(kPhysicsFilter_AllAux);
|
||||||
|
|
||||||
#undef REGISTER_CONSTANT
|
#undef REGISTER_CONSTANT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,10 @@ void Entity::RegisterBaseFunctions()
|
|||||||
m_luaObject.Register("create_box_body", *this, &Entity::Lua_CreateBoxBody);
|
m_luaObject.Register("create_box_body", *this, &Entity::Lua_CreateBoxBody);
|
||||||
m_luaObject.Register("create_sphere_body", *this, &Entity::Lua_CreateSphereBody);
|
m_luaObject.Register("create_sphere_body", *this, &Entity::Lua_CreateSphereBody);
|
||||||
m_luaObject.Register("ForceBodyTransformUpdate", *this, &Entity::Lua_ForceBodyTransformUpdate);
|
m_luaObject.Register("ForceBodyTransformUpdate", *this, &Entity::Lua_ForceBodyTransformUpdate);
|
||||||
|
m_luaObject.Register("set_body_filter_group", *this, &Entity::Lua_SetBodyFilterGroup);
|
||||||
|
m_luaObject.Register("set_body_filter_mask", *this, &Entity::Lua_SetBodyFilterMask);
|
||||||
|
m_luaObject.Register("get_body_filter_group", *this, &Entity::Lua_GetBodyFilterGroup);
|
||||||
|
m_luaObject.Register("get_body_filter_mask", *this, &Entity::Lua_GetBodyFilterMask);
|
||||||
|
|
||||||
// animation
|
// animation
|
||||||
m_luaObject.Register("find_animation", *this, &Entity::Lua_FindAnimation);
|
m_luaObject.Register("find_animation", *this, &Entity::Lua_FindAnimation);
|
||||||
@@ -495,6 +499,43 @@ int Entity::Lua_ForceBodyTransformUpdate(LuaPlus::LuaState* state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Entity::Lua_SetBodyFilterGroup(LuaPlus::LuaState* state)
|
||||||
|
{
|
||||||
|
LuaPlus::LuaStack stack(state);
|
||||||
|
SetBodyFilterGroup((PhysicsFilter)stack[2].GetInteger());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Entity::Lua_SetBodyFilterMask(LuaPlus::LuaState* state)
|
||||||
|
{
|
||||||
|
LuaPlus::LuaStack stack(state);
|
||||||
|
SetBodyFilterMask(stack[2].GetInteger());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Entity::Lua_GetBodyFilterGroup(LuaPlus::LuaState* state)
|
||||||
|
{
|
||||||
|
if (m_rigidBody)
|
||||||
|
state->PushInteger(m_rigidBody->getBroadphaseHandle()->m_collisionFilterGroup);
|
||||||
|
else
|
||||||
|
state->PushInteger(-1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Entity::Lua_GetBodyFilterMask(LuaPlus::LuaState* state)
|
||||||
|
{
|
||||||
|
if (m_rigidBody)
|
||||||
|
state->PushInteger(m_rigidBody->getBroadphaseHandle()->m_collisionFilterMask);
|
||||||
|
else
|
||||||
|
state->PushInteger(-1);
|
||||||
|
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int Entity::Lua_FindAnimation(LuaPlus::LuaState* state)
|
int Entity::Lua_FindAnimation(LuaPlus::LuaState* state)
|
||||||
{
|
{
|
||||||
LuaPlus::LuaStack stack(state);
|
LuaPlus::LuaStack stack(state);
|
||||||
@@ -712,6 +753,22 @@ void Entity::ForceUpdateBodyTranslation()
|
|||||||
m_rigidBody->setWorldTransform(xform);
|
m_rigidBody->setWorldTransform(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Entity::SetBodyFilterGroup(PhysicsFilter group)
|
||||||
|
{
|
||||||
|
if (!m_rigidBody)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_rigidBody->getBroadphaseHandle()->m_collisionFilterGroup = group;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Entity::SetBodyFilterMask(int mask)
|
||||||
|
{
|
||||||
|
if (!m_rigidBody)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_rigidBody->getBroadphaseHandle()->m_collisionFilterMask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_ENTITY(WeaponBase);
|
REGISTER_ENTITY(WeaponBase);
|
||||||
|
|
||||||
WeaponBase::WeaponBase()
|
WeaponBase::WeaponBase()
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ public:
|
|||||||
void UpdateBodyDirty();
|
void UpdateBodyDirty();
|
||||||
void ForceUpdateBodyTranslation();
|
void ForceUpdateBodyTranslation();
|
||||||
|
|
||||||
|
void SetBodyFilterGroup(PhysicsFilter group);
|
||||||
|
void SetBodyFilterMask(int mask);
|
||||||
|
|
||||||
// Game entity lua bindings
|
// Game entity lua bindings
|
||||||
|
|
||||||
void InitFromTable(LuaPlus::LuaObject& _object);
|
void InitFromTable(LuaPlus::LuaObject& _object);
|
||||||
@@ -127,6 +130,10 @@ public:
|
|||||||
int Lua_CreateBoxBody(LuaPlus::LuaState* state);
|
int Lua_CreateBoxBody(LuaPlus::LuaState* state);
|
||||||
int Lua_CreateSphereBody(LuaPlus::LuaState* state);
|
int Lua_CreateSphereBody(LuaPlus::LuaState* state);
|
||||||
int Lua_ForceBodyTransformUpdate(LuaPlus::LuaState* state);
|
int Lua_ForceBodyTransformUpdate(LuaPlus::LuaState* state);
|
||||||
|
int Lua_SetBodyFilterGroup(LuaPlus::LuaState* state);
|
||||||
|
int Lua_SetBodyFilterMask(LuaPlus::LuaState* state);
|
||||||
|
int Lua_GetBodyFilterGroup(LuaPlus::LuaState* state);
|
||||||
|
int Lua_GetBodyFilterMask(LuaPlus::LuaState* state);
|
||||||
|
|
||||||
int Lua_FindAnimation(LuaPlus::LuaState* state);
|
int Lua_FindAnimation(LuaPlus::LuaState* state);
|
||||||
int Lua_PlayAnimation(LuaPlus::LuaState* state);
|
int Lua_PlayAnimation(LuaPlus::LuaState* state);
|
||||||
|
|||||||
@@ -617,7 +617,17 @@ void Model::Draw(const glm::mat4& model, SkeletonInstance* instance /*= nullptr*
|
|||||||
|
|
||||||
glm::vec3 pos = model[3];
|
glm::vec3 pos = model[3];
|
||||||
|
|
||||||
Shader* shader = instance ? g_unlitSkinnedShader : g_unlitShader;
|
Shader* shader = g_unlitSkinnedShader; //instance ? g_unlitSkinnedShader : g_unlitShader;
|
||||||
|
|
||||||
|
static glm::mat4 s_identityBones[128];
|
||||||
|
static bool ready = false;
|
||||||
|
if (!ready)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 128; i++)
|
||||||
|
s_identityBones[i] = glm::mat4(1.0f);
|
||||||
|
|
||||||
|
ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
DLight* light = nullptr;
|
DLight* light = nullptr;
|
||||||
|
|
||||||
@@ -704,6 +714,8 @@ void Model::Draw(const glm::mat4& model, SkeletonInstance* instance /*= nullptr*
|
|||||||
|
|
||||||
if (instance)
|
if (instance)
|
||||||
g_shaderSystem->SetUniformMatrix(shader, UNIFORM_BONE_MATRICES, instance->m_finalMatrices.data(), instance->m_finalMatrices.size());
|
g_shaderSystem->SetUniformMatrix(shader, UNIFORM_BONE_MATRICES, instance->m_finalMatrices.data(), instance->m_finalMatrices.size());
|
||||||
|
else
|
||||||
|
g_shaderSystem->SetUniformMatrix(shader, UNIFORM_BONE_MATRICES, s_identityBones, 128);
|
||||||
|
|
||||||
if (m_data.ib)
|
if (m_data.ib)
|
||||||
g_renderDevice->DrawElements(PT_TRIANGLES, m_data.ibcount, 0, NULL);
|
g_renderDevice->DrawElements(PT_TRIANGLES, m_data.ibcount, 0, NULL);
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ void SoundSystem::Stop(SoundHandle handle)
|
|||||||
|
|
||||||
assert(handle <= -1 || handle <= m_dwSoundsNum);
|
assert(handle <= -1 || handle <= m_dwSoundsNum);
|
||||||
ma_sound_stop(&m_sounds[handle]);
|
ma_sound_stop(&m_sounds[handle]);
|
||||||
|
ma_sound_seek_to_pcm_frame(&m_sounds[handle], 0); // <-- If you also want to restart from the start.
|
||||||
|
ma_sound_reset_stop_time_and_fade(&m_sounds[handle]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SoundSystem::IsPlaying(SoundHandle handle)
|
bool SoundSystem::IsPlaying(SoundHandle handle)
|
||||||
|
|||||||
Reference in New Issue
Block a user