trackgen: add new fence type with different textures on each side

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9355 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
iobyte 2024-03-01 17:31:10 +00:00
parent 4e033ed078
commit 84bea2b814
9 changed files with 14952 additions and 25043 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.59
version : 1.4.60
copyright : (C) 2005 by Charalampos Alexopoulos
-->
<!--
@ -52,6 +52,23 @@ the Free Software Foundation; either version 2 of the License, or
<attnum name="roughness wavelength" unit="m" val="4.0" />
<attnum name="dammage" val="10.0" />
</section>
<section name="test fence 2">
<attnum name="color R1" val="1.0" />
<attnum name="color G1" val="0.0" />
<attnum name="color B1" val="0.0" />
<attnum name="color R2" val="1.0" />
<attnum name="color G2" val="1.0" />
<attnum name="color B2" val="1.0" />
<attstr name="texture name" val="test-fence-2.png" />
<attstr name="texture type" val="continuous" />
<attnum name="texture size" unit="m" val="10.0" />
<attnum name="texture mipmap" unit="m" val="4.0" />
<attnum name="friction" val="0.0" />
<attnum name="bump size" unit="m" val="2.0" />
<attnum name="roughness" unit="m" val="0.03" />
<attnum name="roughness wavelength" unit="m" val="4.0" />
<attnum name="dammage" val="10.0" />
</section>
</section>
<section name="Objects">&default-objects;</section>
<section name="Header">
@ -4429,10 +4446,10 @@ the Free Software Foundation; either version 2 of the License, or
<attstr name="style" val="curb" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.25" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="wall" />
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="2.0" />
<attstr name="surface" val="test fence 2" />
<attstr name="style" val="fence2" />
</section>
<!--End of left part-->
<!--Right part of segment-->
@ -4447,10 +4464,10 @@ the Free Software Foundation; either version 2 of the License, or
<attstr name="style" val="curb" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.25" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="wall" />
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="2.0" />
<attstr name="surface" val="test fence 2" />
<attstr name="style" val="fence2" />
</section>
<!--End of right part-->
</section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View File

@ -249,6 +249,7 @@
#define TRK_VAL_CURB "curb"
#define TRK_VAL_FENCE "fence"
#define TRK_VAL_FENCE1 "fence1"
#define TRK_VAL_FENCE2 "fence2"
#define TRK_VAL_NO_BARRIER "no barrier"

View File

@ -191,6 +191,11 @@ static void InitSides(void *TrackHandle, tTrack *theTrack)
barrierStyle[side] = TR_FENCE1;
barrierWidth[side] = 0;
}
else if (strcmp(style, TRK_VAL_FENCE2) == 0)
{
barrierStyle[side] = TR_FENCE2;
barrierWidth[side] = 0;
}
else
{
barrierStyle[side] = TR_WALL;
@ -284,6 +289,11 @@ static void AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int
barrierStyle[side] = TR_FENCE1;
barrierWidth[side] = 0;
}
else if (strcmp(style, TRK_VAL_FENCE2) == 0)
{
barrierStyle[side] = TR_FENCE2;
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", "fence1"};
private String[] barrierStyleItems = {"none", "no barrier", "wall", "fence", "fence1", "fence2"};
private String[] barrierSurfaceItems =
{"barrier", "barrier2", "barrier-turn", "barrier-grille",
"wall", "wall2", "tire-wall", "asphalt-lines", "asphalt-l-left", "asphalt-l-right", "asphalt-l-both",
@ -552,6 +552,17 @@ public class SegmentSideProperties extends JPanel implements SliderListener
getBarrierWidthSlider().setEnabled(true);
getBarrierWidthSlider().setValueFrozen(side.getBarrierWidth());
break;
case "fence2":
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();
}

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.59";
public final String version = "1.4.60";
private String path;
private double imageScale = 1;

View File

@ -2098,6 +2098,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(texLen, 0.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z);
}
break;
case TR_FENCE2:
if (j == 0)
{
SETPOINT(-texLen, 0.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z);
SETPOINT(-texLen, 0.5, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.5, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z + curBarrier->height);
SETPOINT(-texLen, 1.0, seg->vertex[TR_SR].x, seg->vertex[TR_SR].y, seg->vertex[TR_SR].z);
}
break;
case TR_WALL:
switch (j)
{
@ -2173,6 +2185,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_FENCE2:
if (j == 0)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 0.5, x, y, curHeight + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.5, x, y, curHeight + curBarrier->height);
SETPOINT(-texLen, 1.0, x, y, curHeight);
}
break;
case TR_WALL:
switch (j)
{
@ -2248,6 +2272,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_FENCE2:
if (j == 0)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 0.5, x, y, curHeight + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.5, x, y, curHeight + curBarrier->height);
SETPOINT(-texLen, 1.0, x, y, curHeight);
}
break;
case TR_WALL:
switch (j)
{
@ -2325,6 +2361,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(texLen, 0.0, x, y, curHeight);
}
break;
case TR_FENCE2:
if (j == 0)
{
SETPOINT(-texLen, 0.0, x, y, curHeight);
SETPOINT(-texLen, 0.5, x, y, curHeight + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.5, x, y, curHeight + curBarrier->height);
SETPOINT(-texLen, 1.0, x, y, curHeight);
}
break;
case TR_WALL:
switch (j)
{
@ -2386,6 +2434,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(texLen, 0.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z);
}
break;
case TR_FENCE2:
if (j == 0)
{
SETPOINT(-texLen, 0.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z);
SETPOINT(-texLen, 0.5, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z + curBarrier->height);
}
else if (j == 2)
{
SETPOINT(-texLen, 0.5, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z + curBarrier->height);
SETPOINT(-texLen, 1.0, seg->vertex[TR_ER].x, seg->vertex[TR_ER].y, seg->vertex[TR_ER].z);
}
break;
case TR_WALL:
switch (j)
{
@ -2528,6 +2588,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(-texLen, 1.0, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z + curBarrier->height);
}
break;
case TR_FENCE2:
if (j == 0)
{
SETPOINT(texLen, 0.5, 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, 1.0, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z);
SETPOINT(texLen, 0.5, seg->vertex[TR_SL].x, seg->vertex[TR_SL].y, seg->vertex[TR_SL].z + curBarrier->height);
}
break;
case TR_WALL:
switch (j)
{
@ -2606,6 +2678,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_FENCE2:
if (j == 0)
{
SETPOINT(texLen, 0.5, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, x, y, curHeight);
SETPOINT(texLen, 0.5, x, y, curHeight + curBarrier->height);
}
break;
case TR_WALL:
switch (j)
{
@ -2683,6 +2767,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_FENCE2:
if (j == 0)
{
SETPOINT(texLen, 0.5, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, x, y, curHeight);
SETPOINT(texLen, 0.5, x, y, curHeight + curBarrier->height);
}
break;
case TR_WALL:
switch (j)
{
@ -2761,6 +2857,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_FENCE2:
if (j == 0)
{
SETPOINT(texLen, 0.5, x, y, curHeight + curBarrier->height);
SETPOINT(texLen, 0.0, x, y, curHeight);
}
else if (j == 2)
{
SETPOINT(texLen, 1.0, x, y, curHeight);
SETPOINT(texLen, 0.5, x, y, curHeight + curBarrier->height);
}
break;
case TR_WALL:
switch (j)
{
@ -2827,6 +2935,18 @@ int InitScene(tTrack *Track, void *TrackHandle, bool bump, bool raceline, bool b
SETPOINT(-texLen, 1.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z + curBarrier->height);
}
break;
case TR_FENCE2:
if (j == 0)
{
SETPOINT(texLen, 0.5, 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, 1.0, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z);
SETPOINT(texLen, 0.5, seg->vertex[TR_EL].x, seg->vertex[TR_EL].y, seg->vertex[TR_EL].z + curBarrier->height);
}
break;
case TR_WALL:
switch (j)
{