Ignore:
Timestamp:
Feb 18, 2011, 1:09:28 AM (10 years ago)
Author:
sam
Message:

Get rid of float3, float4, int3 etc. in favour of GLSL types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/piece.cpp

    r633 r664  
    3434    Emitter *emitter;
    3535    Piece *above, *below;
    36     int2 size, cell, pos, src, dst;
     36    vec2i size, cell, pos, src, dst;
    3737    int id;
    3838    float speed, timer, blink, idle;
     
    5757 */
    5858
    59 Piece::Piece(piece_t piece, Emitter *emitter, int2 cell, int id)
     59Piece::Piece(piece_t piece, Emitter *emitter, vec2i cell, int id)
    6060  : data(new PieceData())
    6161{
     
    9696}
    9797
    98 void Piece::SetCell(int2 cell)
     98void Piece::SetCell(vec2i cell)
    9999{
    100100    data->cell = cell;
    101101}
    102102
    103 int2 Piece::GetCell() const
     103vec2i Piece::GetCell() const
    104104{
    105105    return data->cell;
    106106}
    107107
    108 void Piece::SetPos(int2 pos)
     108void Piece::SetPos(vec2i pos)
    109109{
    110110    data->pos = pos;
    111111}
    112112
    113 int2 Piece::GetPos() const
     113vec2i Piece::GetPos() const
    114114{
    115115    return data->pos;
    116116}
    117117
    118 int2 Piece::GetSize() const
     118vec2i Piece::GetSize() const
    119119{
    120120    return data->size;
    121121}
    122122
    123 int2 Piece::GetShift() const
     123vec2i Piece::GetShift() const
    124124{
    125125    return data->pos - data->cell * data->size;
     
    197197}
    198198
    199 int Piece::Grab(int2 dir)
     199int Piece::Grab(vec2i dir)
    200200{
    201201    switch (data->state)
     
    219219}
    220220
    221 int Piece::Ungrab(int2 pos)
     221int Piece::Ungrab(vec2i pos)
    222222{
    223223    switch (data->state)
     
    239239}
    240240
    241 int Piece::Move(int2 pos)
     241int Piece::Move(vec2i pos)
    242242{
    243243    switch (data->state)
     
    289289    {
    290290        data->timer += deltams;
    291         int2 trip = data->dst - data->src;
     291        vec2i trip = data->dst - data->src;
    292292        float moving_time = trip.len() / data->speed;
    293293        float t = moving_time ? data->timer / moving_time : 1.0f;
     
    315315        if (data->timer < 0.0f)
    316316        {
    317             float3 pos(data->pos.x + 24, data->pos.y + 72, 5);
     317            vec3 pos(data->pos.x + 24, data->pos.y + 72, 5);
    318318            int start = data->id + 12;
    319319            int stop = data->id + 15;
     
    322322                float angle = RandF(-1.2f, 1.2f);
    323323                float speed = RandF(0.3f, 0.5f);
    324                 float3 vel(speed * sinf(angle), speed * cosf(angle), 0.0f);
     324                vec3 vel(speed * sinf(angle), speed * cosf(angle), 0.0f);
    325325                data->emitter->AddParticle(id, pos, vel);
    326326            }
Note: See TracChangeset for help on using the changeset viewer.