Changeset 1304
- Timestamp:
- Apr 28, 2012, 3:38:35 PM (10 years ago)
- Location:
- trunk/orbital
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/camera.h
r1302 r1304 40 40 m_view_matrix = mat4::lookat(m_position, m_target, m_up); 41 41 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); 43 43 } 44 44 -
trunk/orbital/mesh.h
r1299 r1304 56 56 else CASE("ascb") { p = GetArg(p, v3, f1); AppendSmoothChamfBox(v3, f1); } 57 57 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); } 59 59 else CASE("as") { p = GetArg(p, f1, f2, f3, f4, f5); AppendStar((int)f1, f2, f3, (int)f4, (int)f5); } 60 60 else CASE("aes") { p = GetArg(p, f1, f2, f3, f4); AppendExpandedStar((int)f1, f2, f3, f4); } … … 156 156 "void main(void)" 157 157 "{" 158 /* Diffuse information -- the level decides this */159 160 158 /* Global shit */ 161 159 " float alpha_mul = 1.0f;" … … 175 173 176 174 /* 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;" 180 178 181 179 " float spec_mul = max(-dot(world_normal, spec_dir), 0.0);" … … 183 181 184 182 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" 188 185 " + diffuse_mul[1] * backColor" 189 186 " + spec_mul * spec_col, 0.0, 1.0);" … … 224 221 " float spec_mul = max(-dot(world_normal, spec_dir), 0.0);" 225 222 " 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" 228 225 " + diffuse_mul[1] * backColor" 229 226 " + spec_mul * spec_col);" … … 543 540 } 544 541 545 void AppendSphere(vec3 const &size, int divisions) 546 { 542 void AppendSphere(int ndivisions, vec3 const &size) 543 { 544 ndivisions *= 2; 545 547 546 int ibase = m_quadidx.Count(); 548 547 int vbase = m_vert.Count(); … … 552 551 553 552 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++) 560 559 { 561 560 int j2 = j + 1; 562 int i2 = (i + 1) % divisions;561 int i2 = (i + 1) % ndivisions; 563 562 564 563 AppendQuadVert(d * vec3(table[i], 1.0f) * table[j].xxy); -
trunk/orbital/orbital.cpp
r1302 r1304 30 30 Orbital::Orbital() 31 31 { 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"); 33 47 m.SendCommand("t0,0,-60,fl"); 34 48 49 /* Pink box */ 35 50 m.SendCommand("sc1,0,1,1,afcb10,10,10,1,rx45,rz45"); 36 51 m.SendCommand("t-20,-20,0,fl"); 37 52 53 /* Large meteor */ 38 54 m.SendCommand("sc0,0,0.3,1,afcb30,30,30,5,ry45,rx45,afcb30,30,30,5"); 39 55 m.SendCommand("t40,40,0,fl"); 40 56 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 */ 44 58 m.SendCommand("sc0.6,0.7,0.8,1,afcb7,4,7,0.6,sc1,0,0.3,1,afcb4,7,4,0.6"); 45 59 m.SendCommand("t-40,20,-30,fl"); 46 60 61 /* Orange/white alien */ 47 62 m.SendCommand("sc1,0.7,0,1,afcb12,3,10,0.4,tz3,sc1,1,1,1,afcb2,10,10,0.4"); 48 63 m.SendCommand("rx20,ry30,t0,40,-20,fl"); 49 64 65 /* Tank body + tank head */ 50 66 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"); 51 67 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"); 52 68 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 */ 55 70 m.SendCommand("sc1,.5,0,1"); 56 71 m.SendCommand("afcb5,1,3,0.6,fl,sc1,1,1,1,afcb1,5,3,0.6,tz-1,irb"); … … 61 76 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"); 62 77 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 */ 63 86 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"); 64 88 65 89 m_particlesystem = new ParticleSystem(); 66 m_camera = new Camera(vec3(0, 150, 200),90 m_camera = new Camera(vec3(0, 200, 300), 67 91 vec3(0, 0, 0), 68 92 vec3(0, 1, 0)); … … 80 104 WorldEntity::TickGame(deltams); 81 105 82 m_angle += deltams / 1000.0f * 90.0f;106 m_angle += deltams / 50.0f; 83 107 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)); 86 109 mat4 model = mat4::translate(vec3(0)); 87 110
Note: See TracChangeset
for help on using the changeset viewer.