Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Commit

Permalink
port changes from VPX
Browse files Browse the repository at this point in the history
  • Loading branch information
toxieainc committed Aug 22, 2022
1 parent 4e6062c commit 6db2e5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
20 changes: 7 additions & 13 deletions ramp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ void Ramp::GenerateWireMesh(Vertex3D_NoTex2 **meshBuf1, Vertex3D_NoTex2 **meshBu
const int numRings = splinePoints;
const int numSegments = accuracy;
m_numVertices = numRings*numSegments;
m_numIndices = 6 * m_numVertices; //m_numVertices*2+2;
m_numIndices = 6 * ((numRings-1)*numSegments); //m_numVertices*2+2;

if (*meshBuf1 == nullptr)
*meshBuf1 = new Vertex3D_NoTex2[m_numVertices];
Expand All @@ -1114,8 +1114,6 @@ void Ramp::GenerateWireMesh(Vertex3D_NoTex2 **meshBuf1, Vertex3D_NoTex2 **meshBu
*meshBuf2 = new Vertex3D_NoTex2[m_numVertices];
}

Vertex3D_NoTex2 *buf1 = *meshBuf1;

if (m_d.m_type != RampType1Wire)
{
CreateWire(numRings, numSegments, rgvLocal, m_vertBuffer);
Expand All @@ -1126,24 +1124,21 @@ void Ramp::GenerateWireMesh(Vertex3D_NoTex2 **meshBuf1, Vertex3D_NoTex2 **meshBu

// calculate faces
for (int i = 0; i < numRings - 1; i++)
{
for (int j = 0; j < numSegments; j++)
{
int quad[4];
quad[0] = i*numSegments + j;

quad[1] = i*numSegments;
if (j != numSegments - 1)
quad[1] = i*numSegments + j + 1;
else
quad[1] = i*numSegments;
quad[1] += j + 1;

if (i != numRings - 1)
{
quad[2] = (i + 1)*numSegments + j;
quad[3] = (i + 1)*numSegments;
if (j != numSegments - 1)
quad[3] = (i + 1)*numSegments + j + 1;
else
quad[3] = (i + 1)*numSegments;
quad[3] += j + 1;
}
else
{
Expand All @@ -1155,16 +1150,15 @@ void Ramp::GenerateWireMesh(Vertex3D_NoTex2 **meshBuf1, Vertex3D_NoTex2 **meshBu
}

const unsigned int offs = (i*numSegments + j) * 6;
m_meshIndices[offs] = quad[0];
m_meshIndices[offs ] = quad[0];
m_meshIndices[offs + 1] = quad[1];
m_meshIndices[offs + 2] = quad[2];
m_meshIndices[offs + 3] = quad[3];
m_meshIndices[offs + 4] = quad[2];
m_meshIndices[offs + 5] = quad[1];
}
}

memcpy(buf1, m_vertBuffer, sizeof(Vertex3D_NoTex2)*m_numVertices);
memcpy(*meshBuf1, m_vertBuffer, sizeof(Vertex3D_NoTex2)*m_numVertices);

if (m_d.m_type != RampType1Wire)
{
Expand Down
2 changes: 2 additions & 0 deletions txt/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ FIXES:

- fix registry defaults load/save for EM-Reels

- fix extremely old wire ramp issue (too many triangles created)

- remove 32 entry limitation for collections in context menu

- on import/rename an image in the image manager also update the comboboxes to select the new image for selected elements
Expand Down
4 changes: 2 additions & 2 deletions vpinball_eng.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,9 @@ STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
COMBOBOX 6,33,4,89,60,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX DISPID_Image,2,27,120,60,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Material",IDC_STATIC1,2,41,26,8
COMBOBOX IDC_MATERIAL_COMBO,2,50,120,60,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX DISPID_Image,2,27,120,60,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX 8,33,66,89,60,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Apply Ima&ge to Wall",9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,2,82,82,10
CONTROL "Visible",IDC_VISIBLE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,2,94,40,10
Expand Down Expand Up @@ -2321,7 +2321,7 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "S&mooth",3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,40,10
CONTROL "Auto Texture Coord.",4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,18,80,10
EDITTEXT 5,54,35,64,12,ES_AUTOHSCROLL
EDITTEXT 5,58,35,60,12,ES_AUTOHSCROLL
LTEXT "&Texture Coord.",IDC_STATIC1,7,37,48,8
GROUPBOX "Position",IDC_STATIC2,4,54,117,79
EDITTEXT 1,52,65,38,12,ES_AUTOHSCROLL
Expand Down

0 comments on commit 6db2e5c

Please sign in to comment.