Changeset 1304


Ignore:
Timestamp:
Apr 28, 2012, 3:38:35 PM (10 years ago)
Author:
sam
Message:

orbital: add more comments to the various meshes we have.

Location:
trunk/orbital
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/orbital/camera.h

    r1302 r1304  
    4040        m_view_matrix = mat4::lookat(m_position, m_target, m_up);
    4141        m_proj_matrix = mat4::perspective(45.0f, 640.0f, 480.0f, 1.f, 1000.0f);
    42         //m_proj_matrix = mat4::ortho(0, 640, 0, -480, .1f, 2000.0f);
     42        //m_proj_matrix = mat4::ortho(-160, 160, -120, 120, .1f, 2000.0f);
    4343    }
    4444
  • trunk/orbital/mesh.h

    r1299 r1304  
    5656            else CASE("ascb") { p = GetArg(p, v3, f1); AppendSmoothChamfBox(v3, f1); }
    5757            else CASE("afcb") { p = GetArg(p, v3, f1); AppendFlatChamfBox(v3, f1); }
    58             else CASE("asph") { p = GetArg(p, v3, f1); AppendSphere(v3, (int)f1); }
     58            else CASE("asph") { p = GetArg(p, f1); p = GetArg(p, v3); AppendSphere((int)f1, v3); }
    5959            else CASE("as")  { p = GetArg(p, f1, f2, f3, f4, f5); AppendStar((int)f1, f2, f3, (int)f4, (int)f5); }
    6060            else CASE("aes") { p = GetArg(p, f1, f2, f3, f4); AppendExpandedStar((int)f1, f2, f3, f4); }
     
    156156            "void main(void)"
    157157            "{"
    158                  /* Diffuse information -- the level decides this */
    159 
    160158                 /* Global shit */
    161159            "    float alpha_mul = 1.0f;"
     
    175173
    176174                 /* Specular: global settings */
    177             "    vec4 spec_col = vec4(0.8, 0.85, 0.4, 1.0);"
    178             "    vec3 spec_dir = normalize(vec3(-0.7, -0.7, 0.4));"
    179             "    float spec_exp = 60.0f;"
     175            "    vec4 spec_col = vec4(0.8, 0.75, 0.4, 1.0);"
     176            "    vec3 spec_dir = normalize(vec3(-0.3, -0.3, -1.8));"
     177            "    float spec_exp = 60.f;"
    180178
    181179            "    float spec_mul = max(-dot(world_normal, spec_dir), 0.0);"
     
    183181
    184182
    185             "    vec4 TmpColor = frontColor * in_Color;"
    186                  /* NOTE: use saturate() in HLSL */
    187             "    pass_Color = clamp(diffuse_mul[0] * TmpColor"
     183            "    vec4 tmpColor = frontColor * in_Color;"
     184            "    pass_Color = clamp(diffuse_mul[0] * tmpColor"
    188185            "                        + diffuse_mul[1] * backColor"
    189186            "                        + spec_mul * spec_col, 0.0, 1.0);"
     
    224221            "    float spec_mul = max(-dot(world_normal, spec_dir), 0.0);"
    225222            "    spec_mul = saturate(pow(spec_mul, spec_exp));"
    226             "    float4 TmpColor = frontColor * in_Color;"
    227             "    pass_Color = saturate(diffuse_mul[0] * TmpColor"
     223            "    float4 tmpColor = frontColor * in_Color;"
     224            "    pass_Color = saturate(diffuse_mul[0] * tmpColor"
    228225            "                           + diffuse_mul[1] * backColor"
    229226            "                           + spec_mul * spec_col);"
     
    543540    }
    544541
    545     void AppendSphere(vec3 const &size, int divisions)
    546     {
     542    void AppendSphere(int ndivisions, vec3 const &size)
     543    {
     544        ndivisions *= 2;
     545
    547546        int ibase = m_quadidx.Count();
    548547        int vbase = m_vert.Count();
     
    552551
    553552        Array<vec2> table;
    554         for (int i = 0; i <= divisions; i++)
    555             table.Append(vec2(std::sin(pi * 2 / divisions * i) + 1e-5f,
    556                               std::cos(pi * 2 / divisions * i) + 1e-5f));
    557 
    558         for (int j = 0; j <= divisions / 2; j++)
    559             for (int i = 0; i < divisions; i++)
     553        for (int i = 0; i <= ndivisions; i++)
     554            table.Append(vec2(std::sin(pi * 2 / ndivisions * i) + 1e-5f,
     555                              std::cos(pi * 2 / ndivisions * i) + 1e-5f));
     556
     557        for (int j = 0; j <= ndivisions / 2; j++)
     558            for (int i = 0; i < ndivisions; i++)
    560559            {
    561560                int j2 = j + 1;
    562                 int i2 = (i + 1) % divisions;
     561                int i2 = (i + 1) % ndivisions;
    563562
    564563                AppendQuadVert(d * vec3(table[i], 1.0f) * table[j].xxy);
  • trunk/orbital/orbital.cpp

    r1302 r1304  
    3030Orbital::Orbital()
    3131{
    32     m.SendCommand("sc1,1,0,1,asph10,16,20,24");
     32    for (int j = 0; j < 20; j++)
     33    {
     34        for (int i = 0; i < 20; i++)
     35        {
     36            m.SendCommand(((i + j) % 2) ? "sc.3,.7,.9,1,scb.3,.7,.9,1"
     37                                        : "sc.3,.3,.7,1,scb.3,.3,.7,1");
     38            m.SendCommand("ac4,2,44,40,0,0,ty-1,ad4,40,0,ry45");
     39            m.Scale(vec3(std::sqrt(0.5f)));
     40            m.Translate(vec3(i * 44 - 440, -50, j * 44 - 440));
     41            m.Flush();
     42        }
     43    }
     44
     45    /* Yellow sphere */
     46    m.SendCommand("sc1,1,0,1,asph10,30,20,24");
    3347    m.SendCommand("t0,0,-60,fl");
    3448
     49    /* Pink box */
    3550    m.SendCommand("sc1,0,1,1,afcb10,10,10,1,rx45,rz45");
    3651    m.SendCommand("t-20,-20,0,fl");
    3752
     53    /* Large meteor */
    3854    m.SendCommand("sc0,0,0.3,1,afcb30,30,30,5,ry45,rx45,afcb30,30,30,5");
    3955    m.SendCommand("t40,40,0,fl");
    4056
    41     m.SendCommand("sc1,1,0,1,scb1,0,0,0,at4,1,s1.5,1,4,tz-13,ad6,5.8,1");
    42     m.SendCommand("t-40,-40,0,fl");
    43 
     57    /* Grey/red bonus */
    4458    m.SendCommand("sc0.6,0.7,0.8,1,afcb7,4,7,0.6,sc1,0,0.3,1,afcb4,7,4,0.6");
    4559    m.SendCommand("t-40,20,-30,fl");
    4660
     61    /* Orange/white alien */
    4762    m.SendCommand("sc1,0.7,0,1,afcb12,3,10,0.4,tz3,sc1,1,1,1,afcb2,10,10,0.4");
    4863    m.SendCommand("rx20,ry30,t0,40,-20,fl");
    4964
     65    /* Tank body + tank head */
    5066    m.SendCommand("sc0.1,0.1,0,1,ab6,6,15,ty-2,sc1,1,1,1,afcb4,5,16,0.4,tx4,tx60,mx,tx120,fl,sc0.2,0.7,0,1,afcb8,7,10,0.4,tz-4,tx60,fl");
    5167    m.SendCommand("sc0.2,0.7,0,1,afcb3,6,10,0.4,tx-8,afcb3,6,10,0.4,tx4,ty10,tx60,fl,sc1,1,1,1,afcb3,6,10,0.4,rx-30,ty10,tx60,fl");
    5268
    53     m.SendCommand("sc1,1,1,1,scb0,0,0,1,aq8,1,sx0.25,tx-3,sc1,0,0,1,scb0,0,0,1,aq8,1,tx4,sz50,sx0.3,tz-200,mx,as10,12,8,1,1,ty60,fl");
    54 
     69    /* Orange player ship */
    5570    m.SendCommand("sc1,.5,0,1");
    5671    m.SendCommand("afcb5,1,3,0.6,fl,sc1,1,1,1,afcb1,5,3,0.6,tz-1,irb");
     
    6176    m.SendCommand("scb1,1,1,1,ac4,15,.2,.6,1,1,tz-2,ac4,15,.2,.6,1,1,rx90,t0,-2,-7,fl");
    6277
     78    /* Orange fire */
     79    m.SendCommand("sc1,1,0,1,scb1,0,0,0,at4,1,s1.5,1,4,tz-13,ad6,5.8,1");
     80    m.SendCommand("t-40,-40,0,fl");
     81
     82    /* Lasers */
     83    m.SendCommand("sc1,1,1,1,scb0,0,0,1,aq8,1,sx0.25,tx-3,sc1,0,0,1,scb0,0,0,1,aq8,1,tx4,sz50,sx0.3,tz-200,mx,as10,12,8,1,1,ty60,fl");
     84
     85    /* Thrusters */
    6386    m.SendCommand("sc0,1,1,scb0,0,0,1,ac5,15,0,1.5,0,1,ac7,35,1.1,4,0,1,rx90,t-3,0,27,mx");
     87    m.SendCommand("fl");
    6488
    6589    m_particlesystem = new ParticleSystem();
    66     m_camera = new Camera(vec3(0, 150, 200),
     90    m_camera = new Camera(vec3(0, 200, 300),
    6791                          vec3(0, 0, 0),
    6892                          vec3(0, 1, 0));
     
    80104    WorldEntity::TickGame(deltams);
    81105
    82     m_angle += deltams / 1000.0f * 90.0f;
     106    m_angle += deltams / 50.0f;
    83107
    84     mat4 anim = mat4::rotate(m_angle, vec3(0, 1, 0))
    85               * mat4::rotate(m_angle * 0.25f, vec3(0, 0, 1));
     108    mat4 anim = mat4::rotate(m_angle, vec3(0, 1, 0));
    86109    mat4 model = mat4::translate(vec3(0));
    87110
Note: See TracChangeset for help on using the changeset viewer.