Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Half-Pixel correction on prebuilt atlasses #164

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion oxygine/src/oxygine/res/ResAtlasPrebuilt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ namespace oxygine

if (columns)
{
bool hpc = child_node.attribute("hpc").as_bool(HPC_DEFAULT);
animationFrames frames;
int frames_count = rows * columns;
frames.reserve(frames_count);

ResAnim* ra = new ResAnim(this);


OX_ASSERT(meta_frames);


Expand Down Expand Up @@ -160,6 +160,7 @@ namespace oxygine
float ih = 1.0f / texture->getHeight();

RectF srcRect(x * iw, y * ih, bbox_w * iw, bbox_h * ih);
if (hpc) srcRect.expand2(Vector2(-0.5f*iw, -0.5f*ih));

float fs = frame_scale;
RectF destRect(
Expand Down
5 changes: 5 additions & 0 deletions oxygine/src/oxygine/res/ResAtlasPrebuilt.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#pragma once
#include "ResAtlas.h"
#ifdef FORCE_HPC
#define HPC_DEFAULT true
#else
#define HPC_DEFAULT false
#endif

namespace oxygine
{
Expand Down