Skip to content

Commit

Permalink
Rename DrawableState_UpdateInverse to DrawableState_UpdateInverseMatr…
Browse files Browse the repository at this point in the history
…ix, and DrawableState_IsUpdateMVP to DrawableState_IsUpdateMVPMatrix.
  • Loading branch information
scottcgi committed Mar 14, 2019
1 parent febc78f commit 2aa2f4d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Engine/Extension/Spine/SkeletonAnimationPlayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static void InitSlotBoundingBoxDrawable(SkeletonAnimationPlayer* player, const c
outDrawable->Render = Render;

// render requires slot mvpMatrix update
ADrawable_AddState(slot->bone->drawable, DrawableState_IsUpdateMVP);
ADrawable_AddState(slot->bone->drawable, DrawableState_IsUpdateMVPMatrix);
}


Expand Down
16 changes: 8 additions & 8 deletions Engine/Graphics/Draw/Drawable.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void Draw(Drawable* drawable)
AMatrix->RotateZ(drawable->modelMatrix, drawable->rotationZ);
}

if (ADrawable_CheckState(drawable, DrawableState_IsUpdateMVP))
if (ADrawable_CheckState(drawable, DrawableState_IsUpdateMVPMatrix))
{
AMatrix->MultiplyMM(ACamera->vp, drawable->modelMatrix, drawable->mvpMatrix);
}
Expand All @@ -84,7 +84,7 @@ static void Draw(Drawable* drawable)
ADrawable_AddState
(
drawable,
DrawableState_TransformChanged | DrawableState_UpdateInverse // NOLINT(hicpp-signed-bitwise)
DrawableState_TransformChanged | DrawableState_UpdateInverseMatrix // NOLINT(hicpp-signed-bitwise)
);
}
else
Expand Down Expand Up @@ -505,9 +505,9 @@ static void ConvertToWorldPositionV2(Drawable* localParent, Vector2* localPositi

static inline void CheckInverse(Drawable* localParent)
{
if (ADrawable_CheckState(localParent, DrawableState_UpdateInverse))
if (ADrawable_CheckState(localParent, DrawableState_UpdateInverseMatrix))
{
ADrawable_ClearState(localParent, DrawableState_UpdateInverse);
ADrawable_ClearState(localParent, DrawableState_UpdateInverseMatrix);
AMatrix->Inverse(localParent->modelMatrix, localParent->inverseMatrix);
}
}
Expand Down Expand Up @@ -715,10 +715,10 @@ static void Init(Drawable* outDrawable)
ADrawable_AddState
(
outDrawable,
DrawableState_Transform | // NOLINT(hicpp-signed-bitwise)
DrawableState_UpdateInverse |
DrawableState_Color |
DrawableState_IsBlendColor |
DrawableState_Transform | // NOLINT(hicpp-signed-bitwise)
DrawableState_UpdateInverseMatrix |
DrawableState_Color |
DrawableState_IsBlendColor |
DrawableState_DrawChanged
);
}
Expand Down
34 changes: 17 additions & 17 deletions Engine/Graphics/Draw/Drawable.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,83 +33,83 @@
*/
typedef enum
{
DrawableState_Null = 0,
DrawableState_Null = 0,

/**
* Whether drawable is invisible.
*/
DrawableState_IsInvisible = 1,
DrawableState_IsInvisible = 1,

/**
* Whether drawable mvp matrix need to update.
*/
DrawableState_IsUpdateMVP = 1 << 1, // NOLINT(hicpp-signed-bitwise)
DrawableState_IsUpdateMVPMatrix = 1 << 1, // NOLINT(hicpp-signed-bitwise)

/**
* Whether drawable calculate blendColor by parent.
*/
DrawableState_IsBlendColor = 1 << 2, // NOLINT(hicpp-signed-bitwise)
DrawableState_IsBlendColor = 1 << 2, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable inverse matrix need to update.
*/
DrawableState_UpdateInverse = 1 << 3, // NOLINT(hicpp-signed-bitwise)
DrawableState_UpdateInverseMatrix = 1 << 3, // NOLINT(hicpp-signed-bitwise)

//----------------------------------------------------------------------------------------------------------------------

/**
* Flag drawable transform has changed.
*/
DrawableState_TransformChanged = 1 << 4, // NOLINT(hicpp-signed-bitwise)
DrawableState_TransformChanged = 1 << 4, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable rgb has changed.
*/
DrawableState_RGBChanged = 1 << 5, // NOLINT(hicpp-signed-bitwise)
DrawableState_RGBChanged = 1 << 5, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable opacity has changed.
*/
DrawableState_OpacityChanged = 1 << 6, // NOLINT(hicpp-signed-bitwise)
DrawableState_OpacityChanged = 1 << 6, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable has been drawn.
*/
DrawableState_DrawChanged = 1 << 7, // NOLINT(hicpp-signed-bitwise)
DrawableState_DrawChanged = 1 << 7, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable color has changed
*/
DrawableState_ColorChanged = DrawableState_RGBChanged | // NOLINT(hicpp-signed-bitwise)
DrawableState_OpacityChanged,
DrawableState_ColorChanged = DrawableState_RGBChanged | // NOLINT(hicpp-signed-bitwise)
DrawableState_OpacityChanged,

//----------------------------------------------------------------------------------------------------------------------

/**
* Flag drawable parent has changed.
*/
DrawableState_Parent = 1 << 8, // NOLINT(hicpp-signed-bitwise)
DrawableState_Parent = 1 << 8, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable position x has changed.
*/
DrawableState_PositionX = 1 << 9, // NOLINT(hicpp-signed-bitwise)
DrawableState_PositionX = 1 << 9, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable position y has changed.
*/
DrawableState_PositionY = 1 << 10, // NOLINT(hicpp-signed-bitwise)
DrawableState_PositionY = 1 << 10, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable position z has changed.
*/
DrawableState_PositionZ = 1 << 11, // NOLINT(hicpp-signed-bitwise)
DrawableState_PositionZ = 1 << 11, // NOLINT(hicpp-signed-bitwise)

/**
* Flag drawable position x and y have changed.
*/
DrawableState_Position2 = DrawableState_PositionX | // NOLINT(hicpp-signed-bitwise)
DrawableState_PositionY,
DrawableState_Position2 = DrawableState_PositionX | // NOLINT(hicpp-signed-bitwise)
DrawableState_PositionY,

//----------------------------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion Engine/Graphics/OpenGL/Mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static void Init(Texture* texture, Mesh* outMesh)
drawable->Draw = Draw;
drawable->Render = Render;

ADrawable_AddState(drawable, DrawableState_IsUpdateMVP);
ADrawable_AddState(drawable, DrawableState_IsUpdateMVPMatrix);

outMesh->texture = texture;
outMesh->vboIds[Mesh_BufferIndex] = 0;
Expand Down
2 changes: 1 addition & 1 deletion Engine/Graphics/OpenGL/Sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static inline void InitSprite(Sprite* sprite, Texture* texture, Array(Quad)* qua
ADrawable->Init(drawable);

// calculate and cache drawable mvp matrix
ADrawable_AddState(drawable, DrawableState_IsUpdateMVP);
ADrawable_AddState(drawable, DrawableState_IsUpdateMVPMatrix);

AQuad->GetMaxSize(quadArr, &drawable->width, &drawable->height);

Expand Down

0 comments on commit 2aa2f4d

Please sign in to comment.