Compare commits

..

No commits in common. "69f355eae41a143ec3b3964d94cfb4fe75188dc2" and "9bc549546fc46c9542c442228d937fb37d386048" have entirely different histories.

4 changed files with 11 additions and 30 deletions

View File

@ -283,7 +283,7 @@ void k3MdlUpdateNrm(struct k3Mdl *mdl, uint8_t *nrm) {
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, mdl->offN, 3 * mdl->verts, nrm);
}
void k3MdlAddMesh(struct k3Mdl *mdl, struct k3Mat *mat, uint32_t idxStart, uint32_t idxNumber) {
void k3MdlAddMesh(struct k3Mdl *mdl, struct k3Mat *mat, uint16_t idxStart, uint16_t idxNumber) {
mdl->meshes = realloc(mdl->meshes, sizeof(*mdl->meshes) * (mdl->meshCount + 1));
struct k3Mesh *mehs = &mdl->meshes[mdl->meshCount++];
mehs->idxStart = idxStart;

View File

@ -146,7 +146,7 @@ struct k3Light {
};
struct k3Mesh {
uint32_t idxStart, idxNumber;
uint16_t idxStart, idxNumber;
struct k3Mat mat;
};
@ -159,7 +159,7 @@ void k3StorageUnref(struct k3Storage*);
struct k3Mdl;
struct k3Mdl *k3MdlCreate(size_t verts, size_t indices, size_t boneCount, vec3 *pos, uint8_t *nrm, float *uvs, uint8_t *cols, uint8_t *boneids, uint16_t *boneweights, uint16_t *inds, mat4 *invBind, uint8_t *boneParents);
void k3MdlUpdatePos(struct k3Mdl *mdl, vec3 *pos);
void k3MdlAddMesh(struct k3Mdl*, struct k3Mat*, uint32_t idxStart, uint32_t idxNumber);
void k3MdlAddMesh(struct k3Mdl*, struct k3Mat*, uint16_t idxStart, uint16_t idxNumber);
struct k3Mesh *k3MdlGetMeshes(struct k3Mdl*, size_t *count);
void k3MdlAddAnim(struct k3Mdl*, struct k3AnimationFountain*);
struct k3AnimationFountain *k3MdlGetAnim(struct k3Mdl*, uint16_t id);

View File

@ -153,15 +153,13 @@ void k3FontDraw(struct k3Font *this, float xStart, float yStart, float sz, const
break;
}
lineLength++;
struct k3FontGlyph *g = k3FontGetGlyph(this, cp2);
if(g) {
if(lineWidth + g->width * this->lineScale * sz > wall) {
break;
}
}
lineLength++;
if(g) {
lineWidth += g->xadvance * this->lineScale * sz;
}
}
@ -191,7 +189,7 @@ void k3FontDraw(struct k3Font *this, float xStart, float yStart, float sz, const
size_t texH = this->texH;
k3BatchAdd(tex,
(struct k3RectF) {(float) (g->x + 0.5) / texW, (float) (g->y + 0.5) / texH, (float) (g->width - 1) / texW, (float) (g->height - 1) / texH},
(struct k3RectF) {(float) g->x / texW, (float) g->y / texH, (float) g->width / texW, (float) g->height / texH},
(struct k3RectF) {
x + g->xoffset * this->lineScale * sz,
y + ((-g->height - g->yoffset) * this->lineScale + 1) * sz,

View File

@ -100,15 +100,6 @@ static bool linear_arrange(struct k3MEvent *ev, uint8_t *ud) {
c->x = o->x + padding[3];
c->y = y;
struct k3MProperty *prop = k3MFindProperty(c, k3M_PROP_WIDTH, true);
if(prop) {
if(prop->units[0] == k3M_UNIT_ABSOLUTE) {
c->w = prop->f[0];
} else if(prop->units[0] == k3M_UNIT_PROPORTION) {
c->w = o->w * prop->f[0];
}
}
if(c->w > o->w - padding[1] - padding[3]) {
c->w = o->w - padding[1] - padding[3];
}
@ -254,7 +245,7 @@ static bool label_draw(struct k3MEvent *ev, uint8_t *ud) {
if(va != k3M_ALIGN_TOP) {
struct k3RectF txtsz;
k3FontSz(this->font, sz, this->txt, this->w, &txtsz);
k3FontSz(this->font, this->sz, this->txt, this->w, &txtsz);
if(va == k3M_ALIGN_CENTER) {
y += (this->h - txtsz.h) / 2;
} else if(va == k3M_ALIGN_BOTTOM) {
@ -271,12 +262,8 @@ static bool label_draw(struct k3MEvent *ev, uint8_t *ud) {
static bool label_measure(struct k3MEvent *ev, uint8_t *ud) {
struct k3MLabel *this = (void*) ev->target;
float sz = this->sz;
struct k3MProperty *prop = k3MFindProperty(this, k3M_PROP_FONT_SIZE, false);
if(prop) sz = prop->f[0];
struct k3RectF txtsz;
k3FontSz(this->font, sz, this->txt, -1, &txtsz);
k3FontSz(this->font, this->sz, this->txt, -1, &txtsz);
this->w = ceilf(txtsz.w);
this->h = ceilf(txtsz.h);
@ -286,12 +273,8 @@ static bool label_measure(struct k3MEvent *ev, uint8_t *ud) {
static bool label_set_height_from_width(struct k3MEvent *ev, uint8_t *ud) {
struct k3MLabel *this = (void*) ev->target;
float sz = this->sz;
struct k3MProperty *prop = k3MFindProperty(this, k3M_PROP_FONT_SIZE, false);
if(prop) sz = prop->f[0];
int16_t pxsz[2];
immdraw_font_size(this->font, sz, this->txt, this->w, pxsz);
immdraw_font_size(this->font, this->sz, this->txt, this->w, pxsz);
this->h = pxsz[1];
@ -314,7 +297,7 @@ struct k3MLabel *k3MLabel(struct k3Font *font, float sz, const char *txt) {
int k3MRemoveChild(struct k3MObj *parent, struct k3MObj *child) {
for(size_t i = 0; i < parent->childCount; i++) {
if(parent->children[i] == child) {
memmove(&parent->children[i], &parent->children[i + 1], sizeof(*parent->children) * (parent->childCount - i - 1));
memcpy(&parent->children[i], &parent->children[i + 1], sizeof(*parent->children) * (parent->childCount - i - 1));
parent->childCount--;
@ -472,7 +455,7 @@ static bool screen_ev(struct k3MEvent *ev, uint8_t *ud) {
}
for(intmax_t i = 0; i < this->childCount; i++) {
for(intmax_t i = this->childCount - 1; i >= 0; i--) {
if(!this->children[i]->invisible) {
struct k3MEvent newev = *ev;
newev.kind = k3M_EVENTKIND_CAPTURE;