trackgen: add new fence type with same texture on both sides

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9353 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
iobyte 2024-03-01 14:30:44 +00:00
parent f716a9500b
commit 7071a45605
9 changed files with 4337 additions and 706 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
<!--
file : barrier-testtrack.xml
auto generated : by sd2-trackeditor
version : 1.4.58
version : 1.4.59
copyright : (C) 2005 by Charalampos Alexopoulos
-->
<!--
@ -4478,8 +4478,8 @@ the Free Software Foundation; either version 2 of the License, or
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="2.0" />
<attstr name="surface" val="test fence 1" />
<attstr name="style" val="fence" />
<attstr name="surface" val="barrier-grille" />
<attstr name="style" val="fence1" />
</section>
<!--End of left part-->
<!--Right part of segment-->
@ -4496,8 +4496,8 @@ the Free Software Foundation; either version 2 of the License, or
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="2.0" />
<attstr name="surface" val="test fence 1" />
<attstr name="style" val="fence" />
<attstr name="surface" val="barrier-grille" />
<attstr name="style" val="fence1" />
</section>
<!--End of right part-->
</section>

View File

@ -248,6 +248,7 @@
#define TRK_VAL_WALL "wall"
#define TRK_VAL_CURB "curb"
#define TRK_VAL_FENCE "fence"
#define TRK_VAL_FENCE1 "fence1"
#define TRK_VAL_NO_BARRIER "no barrier"
@ -324,9 +325,11 @@ enum tSegStyle
TR_PLAN = 0, /**< Flat (border only) */
TR_CURB = 1, /**< Curb (border only) */
TR_WALL = 2, /**< Wall (border and barrier) */
TR_FENCE = 3, /**< Fence (no width) (barrier only) */
TR_FENCE = 3, /**< Fence (no width) (barrier only) (2 sided geometry) (texture mirrored on back side) */
TR_PITBUILDING = 4, /**< Pit building wall (barrier only) */
TR_NO_BARRIER = 5 /**< No Barrier (barrier only) */
TR_NO_BARRIER = 5, /**< No Barrier (barrier only) */
TR_FENCE1 = 6, /**< Fence (no width) (barrier only) (1 sided geometry) (same texture on both sides) */
TR_FENCE2 = 7, /**< Fence (no width) (barrier only) (1 sided geometry) (different texture on each side) */
};
/** Barrier */

View File

@ -38,7 +38,7 @@ static const char *SectSide[2] = {TRK_SECT_RSIDE, TRK_SECT_LSIDE};
static const char *SectBorder[2] = {TRK_SECT_RBORDER, TRK_SECT_LBORDER};
static const char *SectBarrier[2] = {TRK_SECT_RBARRIER, TRK_SECT_LBARRIER};
static const char *ValStyle[] = {TRK_VAL_PLAN, TRK_VAL_CURB, TRK_VAL_WALL, TRK_VAL_FENCE, TRK_VAL_FENCE};
static const char *ValStyle[] = {TRK_VAL_PLAN, TRK_VAL_CURB, TRK_VAL_WALL, TRK_VAL_FENCE, TRK_VAL_FENCE, TRK_VAL_FENCE1};
static tdble sideEndWidth[2];
static tdble sideStartWidth[2];
@ -186,6 +186,11 @@ static void InitSides(void *TrackHandle, tTrack *theTrack)
barrierStyle[side] = TR_FENCE;
barrierWidth[side] = 0;
}
else if (strcmp(style, TRK_VAL_FENCE1) == 0)
{
barrierStyle[side] = TR_FENCE1;
barrierWidth[side] = 0;
}
else
{
barrierStyle[side] = TR_WALL;
@ -274,6 +279,11 @@ static void AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int
barrierStyle[side] = TR_FENCE;
barrierWidth[side] = 0;
}
else if (strcmp(style, TRK_VAL_FENCE1) == 0)
{
barrierStyle[side] = TR_FENCE1;
barrierWidth[side] = 0;
}
else if (strcmp(style, TRK_VAL_WALL) == 0)
{
barrierStyle[side] = TR_WALL;

View File

@ -75,7 +75,7 @@ public class SegmentSideProperties extends JPanel implements SliderListener
"b-asphalt-grass6", "b-asphalt-grass6-l1", "b-asphalt-sand3", "b-asphalt-sand3-l1", "barrier", "barrier2",
"barrier-turn", "barrier-grille", "wall", "wall2", "tire-wall"};
private Vector<String> sideSurfaceVector = new Vector<String>();
private String[] barrierStyleItems = {"none", "no barrier", "wall", "fence"};
private String[] barrierStyleItems = {"none", "no barrier", "wall", "fence", "fence1"};
private String[] barrierSurfaceItems =
{"barrier", "barrier2", "barrier-turn", "barrier-grille",
"wall", "wall2", "tire-wall", "asphalt-lines", "asphalt-l-left", "asphalt-l-right", "asphalt-l-both",
@ -541,6 +541,17 @@ public class SegmentSideProperties extends JPanel implements SliderListener
getBarrierWidthSlider().setEnabled(true);
getBarrierWidthSlider().setValueFrozen(side.getBarrierWidth());
break;
case "fence1":
side.setBarrierSurface(SegmentSide.DEFAULT_BARRIER_FENCE_SURFACE);
side.setBarrierHeight(SegmentSide.DEFAULT_BARRIER_FENCE_HEIGHT);
side.setBarrierWidth(SegmentSide.DEFAULT_BARRIER_FENCE_WIDTH);
getBarrierSurfaceComboBox().setEnabled(true);
getBarrierSurfaceComboBox().setSelectedItem(side.getBarrierSurface());
getBarrierHeightSlider().setEnabled(true);
getBarrierHeightSlider().setValue(side.getBarrierHeight());
getBarrierWidthSlider().setEnabled(true);
getBarrierWidthSlider().setValueFrozen(side.getBarrierWidth());
break;
}
parent.sideChanged();
}
@ -803,6 +814,9 @@ public class SegmentSideProperties extends JPanel implements SliderListener
case "fence":
checkBarrierFence(segment, side);
break;
case "fence1":
checkBarrierFence(segment, side);
break;
case "plan":
case "curb":
checkBarrierInvalid(segment, side);

View File

@ -34,7 +34,7 @@ public class Properties
private static Properties instance = new Properties();
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
public final String title = "sd2-trackeditor";
public final String version = "1.4.58";
public final String version = "1.4.59";
private String path;
private double imageScale = 1;

View File

@ -98,7 +98,7 @@ public:
//! Constructor.
Application::Application()
: GfApplication("TrackGen", "1.6.0.39", "Terrain generator for tracks")
: GfApplication("TrackGen", "1.6.0.40", "Terrain generator for tracks")
, HeightSteps(30)
, Bump(false)
, Raceline(false)

View File

@ -847,6 +847,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -927,6 +929,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1019,6 +1023,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1112,6 +1118,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1184,6 +1192,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1460,6 +1470,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1540,6 +1552,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1632,6 +1646,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1725,6 +1741,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -1797,6 +1815,8 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
}
break;
case TR_FENCE:
case TR_FENCE1:
case TR_FENCE2:
case TR_PITBUILDING:
case TR_NO_BARRIER:
// not supported
@ -2066,6 +2086,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(-texLen, 1.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z + curBarrier->height);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(-texLen, 0.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z);
SETPOINT(-texLen, 1.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z + curBarrier->height);
SETPOINT(texLen, 0.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z);
}
break;
case TR_WALL:
switch (j)
{
@ -2125,10 +2157,22 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
case TR_FENCE:
if (j == 0)
{
SETPOINT(-texLen, 0, x, y, curHeight);
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_WALL:
switch (j)
{
@ -2192,6 +2236,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_WALL:
switch (j)
{
@ -2257,6 +2313,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_WALL:
switch (j)
{
@ -2306,6 +2374,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(-texLen, 1.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z + curBarrier->height);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(-texLen, 0.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z);
SETPOINT(-texLen, 1.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z + curBarrier->height);
SETPOINT(texLen, 0.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z);
}
break;
case TR_WALL:
switch (j)
{
@ -2436,6 +2516,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(texLen, 0.0, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(texLen, 1.0, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z + curBarrier->height);
SETPOINT(texLen, 0.0, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.0, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z);
SETPOINT(-texLen, 1.0, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z + curBarrier->height);
}
break;
case TR_WALL:
switch (j)
{
@ -2499,7 +2591,19 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
if (j == 0)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0, x, y, curHeight);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
break;
case TR_WALL:
@ -2564,7 +2668,19 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
if (j == 0)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0, x, y, curHeight);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
break;
case TR_WALL:
@ -2630,7 +2746,19 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
if (j == 0)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0, x, y, curHeight);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(texLen, 1.0, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 1.0, x, y, curHeight + curBarrier->height);
}
break;
case TR_WALL:
@ -2684,7 +2812,19 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
if (j == 0)
{
SETPOINT(texLen, 1.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z + curBarrier->height);
SETPOINT(texLen, 0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z);
SETPOINT(texLen, 0.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z);
}
break;
case TR_FENCE1:
if (j == 0)
{
SETPOINT(texLen, 1.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z + curBarrier->height);
SETPOINT(texLen, 0.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z);
SETPOINT(-texLen, 1.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z + curBarrier->height);
}
break;
case TR_WALL: