Example #1
0
Material::Material(Material_t tag)
    : tag(tag),
      vertexShader(this),
      fragmentShader(this),
      index0AttributeName(this)
{
    mId = Material::MaterialIdCount++;

    mUuid = Math::generateUUID();

    mName = "";

    side() = kFrontSide;

    opacity() = 1.0f;
    transparent() = false;

    blending() = kNormalBlending;

    blendSrc() = kSrcAlphaFactor;
    blendDst() = kOneMinusSrcAlphaFactor;
    blendEquation() = kAddEquation;

    depthTest() = true;
    depthWrite() = true;

    polygonOffset() = false;
    polygonOffsetFactor() = 0;
    polygonOffsetUnits() = 0;

    // mAlphaTest = 0;

    overdraw() = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer

    visible() = true;

    needsUpdate() = true;

    // By default, bind position to attribute index 0. In WebGL, attribute 0
    // should always be used to avoid potentially expensive emulation.
    index0AttributeName("position");

    linewidth() = 1.0f;
    metal() = false;
    perPixel() = true;
    shading() = kNoShading;
	vertexColors() = kNoColors;
    wireframe() = false;
    wireframeLinewidth() = 1.0f;
}
Example #2
0
void gun:: shoot(Dot myDot, enemy *monsters[], Tile *tiles[], Converter conv)
{
    melee();
    if(look_up)
        box.y -= speed;
    else if(look_down)
    {
        shoot_down = true;
        box.y += speed;
    }
    else if(right)
        box.x += speed;              //   take away speed, creates little mines
    else if(left)
        box.x -= speed;
    shot = true;

    shot_dis++;

    for(int i = 0; i < monster_count; i++)
    {
        if(check_collision( box, monsters[i]->box) == true && monsters[i]->alive)
        {
         //   shot = false;
            shot_dis = 0;
        }
    }


    for( int i = 0; i < NORMAL_TILES; i++ )
    {
        //If the tile is a wall type tile
        if( ( tiles[ i ]->get_type() == Solid_Tile ) )
        {

            if(check_collision( box, tiles[i]->box) == true)
            {

                if(look_up)
                {
                    if(perPixel(conv.pixel_array10, conv.size10, tiles[i]->get_box()))
                    {
                        shot = false;
                        shot_dis = 0;
                    }
                }

                else if(look_down)
                {
                    if(perPixel(conv.pixel_array9, conv.size9, tiles[i]->get_box()))
                    {
                        shot = false;
                        shot_dis = 0;
                    }
                }

                else if(!direction)
                {
                    if(perPixel(conv.pixel_array8, conv.size8, tiles[i]->get_box()))
                    {
                        shot = false;
                        shot_dis = 0;
                    }
                }
                else
                {
                    if(perPixel(conv.pixel_array7, conv.size7, tiles[i]->get_box()))
                    {
                        shot = false;
                        shot_dis = 0;
                    }
                }
            }
        }
    }
}