Changeset 1784
- Timestamp:
- Aug 21, 2012, 2:09:14 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/easymesh/easymesh.cpp
r1719 r1784 238 238 } 239 239 240 void EasyMesh::RadialJitter(float r) 241 { 242 Array<int> Welded; 243 Welded.Push(-1); 244 for (int i = m_cursors.Last().m1 + 1; i < m_vert.Count(); i++) 245 { 246 int j; 247 for (j = m_cursors.Last().m1; j < i; j++) 248 { 249 if(sqlength(m_vert[i].m1 - m_vert[j].m1) < 0.1f) 250 break; 251 } 252 253 if(j == i) 254 Welded.Push(-1); 255 else 256 Welded.Push(j); 257 } 258 259 int i, j; 260 for (i = m_cursors.Last().m1, j = 0; i < m_vert.Count(); i++, j++) 261 { 262 if(Welded[j] == -1) 263 m_vert[i].m1 *= 1.0f + RandF(r); 264 else 265 m_vert[i].m1 = m_vert[Welded[j]].m1; 266 } 267 268 ComputeNormals(m_cursors.Last().m2, m_indices.Count() - m_cursors.Last().m2); 269 } 270 240 271 void EasyMesh::TaperX(float y, float z, float xoff) 241 272 { -
trunk/src/easymesh/easymesh.h
r1705 r1784 52 52 void SetCurVertNormal(vec3 const &normal); 53 53 void SetCurVertColor(vec4 const &color); 54 55 void RadialJitter(float r); 54 56 55 57 void Translate(vec3 const &v); -
trunk/tutorial/05_easymesh.cpp
r1705 r1784 30 30 m_mesh.Compile("ad12,2.2,0 ty.1 ac12,.2,2.4,2.2,0,1 ty.8 ac12,1.7,2.4,2.4,0,1 ty2.5"); 31 31 m_mesh.Translate(vec3(i * 8.f, (h - 1) * 3.2f, j * 8.f)); 32 m_mesh.CloseBrace(); 32 33 m_mesh.CloseBrace(); 33 34 } 34 35 m_mesh.OpenBrace(); … … 37 38 m_mesh.CloseBrace(); 38 39 m_mesh.Translate(vec3(dx * 8.f, dh * 3.2f, dy * 8.f)); 40 39 41 m_mesh.CloseBrace(); 40 42 } … … 43 45 { 44 46 m_angle = 0; 45 //m_mesh.Compile("sc#e94 scb#964 [asph11 7 7 7 tx10]"); 47 m_mesh.Compile("sc#800 [asph10 20 20 20]"); 48 m_mesh.RadialJitter(0.2f); 46 49 //m_mesh.Compile("sc#94e scb#649 [asph3 7 7 7 tx-6 tz-9]"); 47 50 //m_mesh.Compile("sc#49e scb#469 [asph31 7 7 7 tx-6 tz9]");
Note: See TracChangeset
for help on using the changeset viewer.