1274 {
1276 {
1277 return;
1278 }
1279
1280
1281
1282
1283
1284 GL.Disable(EnableCap.CullFace);
1285 GL.Disable(EnableCap.Lighting);
1286 GL.Disable(EnableCap.DepthTest);
1287 GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
1288
1289 switch (type)
1290 {
1291 case 0:
1293 {
1294 case 0:
1295 GL.Color4(selected ? 0.0f : 0.5f, 0.5f, 0.0f, 0.5f);
1296 break;
1297 default:
1298 GL.Color4(selected ? 0.0f : 1.0f, 1.0f, 0.0f, 0.5f);
1299 break;
1300 case 2:
1301 GL.Color4(selected ? 0.0f : 1.0f, 1.0f, 0.25f, 0.5f);
1302 break;
1303 }
1304
1305 break;
1306 case 1:
1308 {
1309 case 0:
1310 GL.Color4(selected ? 0.0f : 0.0f, 0.5f, 0.0f, 0.5f);
1311 break;
1312 default:
1313 GL.Color4(selected ? 0.0f : 0.0f, 1.0f, 0.0f, 0.5f);
1314 break;
1315 case 2:
1316 GL.Color4(selected ? 0.0f : 0.0f, 1.0f, 0.25f, 0.5f);
1317 break;
1318 }
1319
1320 break;
1321 default:
1323 {
1324 case 0:
1325 GL.Color4(0.0f, selected ? 0.5f : 0.0f, selected ? 0.0f : 0.5f, 0.5f);
1326 break;
1327 default:
1328 GL.Color4(0.0f, selected ? 1.0f : 0.0f, selected ? 0.0f : 1.0f, 0.5f);
1329 break;
1330 case 2:
1331 GL.Color4(0.0f, selected ? 1.0f : 0.25f, selected ? 0.25f : 1.0f, 0.5f);
1332 break;
1333 }
1334
1335 break;
1336 }
1337
1341 bonescl = BoneNode._frameMatrix
1342 .GetScale();
1343
1344 bonescl *= _radius;
1346
1347 GL.PushMatrix();
1348 GL.MultMatrix((float*) &m);
1349
1351 new Vector3(_stretch.
_x / bonescl.
_x, _stretch.
_y / bonescl.
_y, _stretch.
_z / bonescl.
_z);
1352 GL.Translate(_offst.
_x / bonescl.
_x, _offst.
_y / bonescl.
_y, _offst.
_z / bonescl.
_z);
1353
1354 int res = 16;
1355 double angle = 360.0 / res;
1356
1357
1358 for (int quadrant = 0; quadrant < 8; quadrant++)
1359 {
1360 for (double i = 0; i < 180 / angle; i++)
1361 {
1362 double ringang1 = i * angle / 180 * Math.PI;
1363 double ringang2 = (i + 1) * angle / 180 * Math.PI;
1364
1365 for (double j = 0; j < 360 / angle; j++)
1366 {
1367 double ang1 = j * angle / 180 * Math.PI;
1368 double ang2 = (j + 1) * angle / 180 * Math.PI;
1369
1370 int q = 0;
1372
1373 if (Math.Cos(ang2) >= 0)
1374 {
1375 q += 4;
1376 if (_stretch.
_x > 0)
1377 {
1378 stretch._x = stretchfac.
_x;
1379 }
1380 }
1381 else
1382 {
1383 if (_stretch.
_x < 0)
1384 {
1385 stretch._x = stretchfac.
_x;
1386 }
1387 }
1388
1389 if (Math.Sin(ang2) >= 0)
1390 {
1391 q += 2;
1392 if (_stretch.
_y > 0)
1393 {
1394 stretch._y = stretchfac.
_y;
1395 }
1396 }
1397 else
1398 {
1399 if (_stretch.
_y < 0)
1400 {
1401 stretch._y = stretchfac.
_y;
1402 }
1403 }
1404
1405 if (Math.Cos(ringang2) >= 0)
1406 {
1407 q += 1;
1408 if (_stretch.
_z > 0)
1409 {
1410 stretch._z = stretchfac.
_z;
1411 }
1412 }
1413 else
1414 {
1415 if (_stretch.
_z < 0)
1416 {
1417 stretch._z = stretchfac.
_z;
1418 }
1419 }
1420
1421 if (quadrant == q)
1422 {
1423 GL.Translate(stretch._x, stretch._y, stretch._z);
1424 GL.Begin(BeginMode.Quads);
1425 GL.Vertex3(Math.Cos(ang1) * Math.Sin(ringang2), Math.Sin(ang1) * Math.Sin(ringang2),
1426 Math.Cos(ringang2));
1427 GL.Vertex3(Math.Cos(ang2) * Math.Sin(ringang2), Math.Sin(ang2) * Math.Sin(ringang2),
1428 Math.Cos(ringang2));
1429 GL.Vertex3(Math.Cos(ang2) * Math.Sin(ringang1), Math.Sin(ang2) * Math.Sin(ringang1),
1430 Math.Cos(ringang1));
1431 GL.Vertex3(Math.Cos(ang1) * Math.Sin(ringang1), Math.Sin(ang1) * Math.Sin(ringang1),
1432 Math.Cos(ringang1));
1433 GL.End();
1434 GL.Translate(-stretch._x, -stretch._y, -stretch._z);
1435 }
1436 }
1437 }
1438 }
1439
1440
1441 double x1, x2, y1, y2, z1, z2;
1442
1443
1444 for (double i = 0; i < 360 / angle; i++)
1445 {
1446 double ang1 = i * angle / 180 * Math.PI;
1447 double ang2 = (i + 1) * angle / 180 * Math.PI;
1448
1449 z1 = Math.Cos(ang1);
1450 z2 = Math.Cos(ang2);
1451 y1 = Math.Sin(ang1);
1452 y2 = Math.Sin(ang2);
1453
1454 x1 = _stretch._x < 0 ? stretchfac._x : 0;
1455 x2 = _stretch._x > 0 ? stretchfac._x : 0;
1456
1457 if (y2 >= 0 && _stretch.
_y > 0)
1458 {
1459 y1 += stretchfac.
_y;
1460 y2 += stretchfac.
_y;
1461 }
1462
1463 if (y2 <= 0 && _stretch.
_y < 0)
1464 {
1465 y1 += stretchfac.
_y;
1466 y2 += stretchfac.
_y;
1467 }
1468
1469 if (z2 >= 0 && _stretch.
_z > 0)
1470 {
1471 z1 += stretchfac.
_z;
1472 z2 += stretchfac.
_z;
1473 }
1474
1475 if (z2 <= 0 && _stretch.
_z < 0)
1476 {
1477 z1 += stretchfac.
_z;
1478 z2 += stretchfac.
_z;
1479 }
1480
1481 GL.Begin(BeginMode.Quads);
1482 GL.Vertex3(x1, y1, z1);
1483 GL.Vertex3(x2, y1, z1);
1484 GL.Vertex3(x2, y2, z2);
1485 GL.Vertex3(x1, y2, z2);
1486 GL.End();
1487 }
1488
1489
1490 for (double i = 0; i < 360 / angle; i++)
1491 {
1492 double ang1 = i * angle / 180 * Math.PI;
1493 double ang2 = (i + 1) * angle / 180 * Math.PI;
1494
1495 x1 = Math.Cos(ang1);
1496 x2 = Math.Cos(ang2);
1497 z1 = Math.Sin(ang1);
1498 z2 = Math.Sin(ang2);
1499
1500 y1 = _stretch._y < 0 ? stretchfac._y : 0;
1501 y2 = _stretch._y > 0 ? stretchfac._y : 0;
1502
1503 if (x2 >= 0 && _stretch.
_x > 0)
1504 {
1505 x1 += stretchfac.
_x;
1506 x2 += stretchfac.
_x;
1507 }
1508
1509 if (x2 <= 0 && _stretch.
_x < 0)
1510 {
1511 x1 += stretchfac.
_x;
1512 x2 += stretchfac.
_x;
1513 }
1514
1515 if (z2 >= 0 && _stretch.
_z > 0)
1516 {
1517 z1 += stretchfac.
_z;
1518 z2 += stretchfac.
_z;
1519 }
1520
1521 if (z2 <= 0 && _stretch.
_z < 0)
1522 {
1523 z1 += stretchfac.
_z;
1524 z2 += stretchfac.
_z;
1525 }
1526
1527 GL.Begin(BeginMode.Quads);
1528 GL.Vertex3(x1, y1, z1);
1529 GL.Vertex3(x1, y2, z1);
1530 GL.Vertex3(x2, y2, z2);
1531 GL.Vertex3(x2, y1, z2);
1532 GL.End();
1533 }
1534
1535
1536 for (double i = 0; i < 360 / angle; i++)
1537 {
1538 double ang1 = i * angle / 180 * Math.PI;
1539 double ang2 = (i + 1) * angle / 180 * Math.PI;
1540
1541 x1 = Math.Cos(ang1);
1542 x2 = Math.Cos(ang2);
1543 y1 = Math.Sin(ang1);
1544 y2 = Math.Sin(ang2);
1545
1546 z1 = _stretch._z < 0 ? stretchfac._z : 0;
1547 z2 = _stretch._z > 0 ? stretchfac._z : 0;
1548
1549 if (x2 >= 0 && _stretch.
_x > 0)
1550 {
1551 x1 += stretchfac.
_x;
1552 x2 += stretchfac.
_x;
1553 }
1554
1555 if (x2 <= 0 && _stretch.
_x < 0)
1556 {
1557 x1 += stretchfac.
_x;
1558 x2 += stretchfac.
_x;
1559 }
1560
1561 if (y2 >= 0 && _stretch.
_y > 0)
1562 {
1563 y1 += stretchfac.
_y;
1564 y2 += stretchfac.
_y;
1565 }
1566
1567 if (y2 <= 0 && _stretch.
_y < 0)
1568 {
1569 y1 += stretchfac.
_y;
1570 y2 += stretchfac.
_y;
1571 }
1572
1573 GL.Begin(BeginMode.Quads);
1574 GL.Vertex3(x2, y2, z1);
1575 GL.Vertex3(x2, y2, z2);
1576 GL.Vertex3(x1, y1, z2);
1577 GL.Vertex3(x1, y1, z1);
1578 GL.End();
1579 }
1580
1582
1583
1584 GL.Begin(BeginMode.Quads);
1585 float outpos;
1586
1587
1588 outpos = _radius / bonescl._x * scale.
_x;
1589 if (_stretch.
_x > 0)
1590 {
1591 outpos = (_stretch._x + _radius) / bonescl.
_x;
1592 }
1593
1594 GL.Vertex3(outpos, 0, 0);
1595 GL.Vertex3(outpos, stretchfac.
_y, 0);
1596 GL.Vertex3(outpos, stretchfac.
_y, stretchfac.
_z);
1597 GL.Vertex3(outpos, 0, stretchfac.
_z);
1598
1599
1600 outpos = -_radius / bonescl._x * scale.
_x;
1601 if (_stretch.
_x < 0)
1602 {
1603 outpos = (_stretch._x - _radius) / bonescl.
_x;
1604 }
1605
1606 GL.Vertex3(outpos, 0, 0);
1607 GL.Vertex3(outpos, 0, stretchfac.
_z);
1608 GL.Vertex3(outpos, stretchfac.
_y, stretchfac.
_z);
1609 GL.Vertex3(outpos, stretchfac.
_y, 0);
1610
1611
1612 outpos = _radius / bonescl._y * scale.
_y;
1613 if (_stretch.
_y > 0)
1614 {
1615 outpos = (_stretch._y + _radius) / bonescl.
_y;
1616 }
1617
1618 GL.Vertex3(0, outpos, 0);
1619 GL.Vertex3(0, outpos, stretchfac.
_z);
1620 GL.Vertex3(stretchfac.
_x, outpos, stretchfac.
_z);
1621 GL.Vertex3(stretchfac.
_x, outpos, 0);
1622
1623
1624 outpos = -_radius / bonescl._y * scale.
_y;
1625 if (_stretch.
_y < 0)
1626 {
1627 outpos = (_stretch._y - _radius) / bonescl.
_y;
1628 }
1629
1630 GL.Vertex3(0, outpos, 0);
1631 GL.Vertex3(stretchfac.
_x, outpos, 0);
1632 GL.Vertex3(stretchfac.
_x, outpos, stretchfac.
_z);
1633 GL.Vertex3(0, outpos, stretchfac.
_z);
1634
1635
1636 outpos = _radius / bonescl._z * scale.
_z;
1637 if (_stretch.
_z > 0)
1638 {
1639 outpos = (_stretch._z + _radius) / bonescl.
_z;
1640 }
1641
1642 GL.Vertex3(0, 0, outpos);
1643 GL.Vertex3(stretchfac.
_x, 0, outpos);
1644 GL.Vertex3(stretchfac.
_x, stretchfac.
_y, outpos);
1645 GL.Vertex3(0, stretchfac.
_y, outpos);
1646
1647
1648 outpos = -_radius / bonescl._z * scale.
_z;
1649 if (_stretch.
_z < 0)
1650 {
1651 outpos = (_stretch._z - _radius) / bonescl.
_z;
1652 }
1653
1654 GL.Vertex3(0, 0, outpos);
1655 GL.Vertex3(0, stretchfac.
_y, outpos);
1656 GL.Vertex3(stretchfac.
_x, stretchfac.
_y, outpos);
1657 GL.Vertex3(stretchfac.
_x, 0, outpos);
1658 GL.End();
1659
1660 GL.PopMatrix();
1661 }
Matrix _frameMatrix
Definition: MDL0BoneNode.cs:58
HurtBoxZone Zone
Definition: DataMiscNode.cs:1209
MDL0BoneNode BoneNode
Definition: DataMiscNode.cs:1117
Vector3 GetAngles()
Definition: Matrix.cs:971
static Matrix TransformMatrix(Vector3 scale, Vector3 rotate, Vector3 translate)
Definition: Matrix.cs:1214
Vector3 GetScale()
Definition: Matrix.cs:329
Vector3 GetPoint()
Definition: Matrix.cs:321
Definition: Vector3.cs:40
float _y
Definition: Vector3.cs:41
float _z
Definition: Vector3.cs:41
float _x
Definition: Vector3.cs:41