Skip to content

Commit ddb9fb9

Browse files
committed
Add rear lights for SUV and sports car
1 parent f7516b3 commit ddb9fb9

7 files changed

Lines changed: 37 additions & 9 deletions

File tree

‎data/Materials/Cars/SUV/SUV_Optics.mat‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
</Object>
7373
</Property>
7474
<Property type="Float4" name="m_emissiveColor" x="1" y="1" z="1" w="1"/>
75-
<Property type="Float" name="m_emissiveIntensity" value="0.5"/>
75+
<Property type="Float" name="m_emissiveIntensity" value="0"/>
7676
</Object>
7777
</Property>
7878
</Object>

‎data/Meshes/Cars/SUV/suv.fbx‎

9.11 KB
Binary file not shown.

‎data/Meshes/Cars/Sport/sport.fbx‎

11.4 KB
Binary file not shown.

‎data/Prefabs/Cars/SUV.prefab‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<Property type="String" name="m_name" value="New SoundComponent"/>
9999
<Property type="Uint32" name="m_uid" value="634290429"/>
100100
<Property type="Uint32" name="m_originalUID" value="0"/>
101-
<Property type="EnumFlagsU16" name="m_objectFlags" value="Opened"/>
101+
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
102102
<Property type="EnumFlagsU32" name="m_flags" value="Enabled"/>
103103
<Property type="Object" name="m_sounds">
104104
<Object class="SoundResourceList">
@@ -155,7 +155,7 @@
155155
<Property type="String" name="m_name" value="New MeshComponent"/>
156156
<Property type="Uint32" name="m_uid" value="740601882"/>
157157
<Property type="Uint32" name="m_originalUID" value="0"/>
158-
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
158+
<Property type="EnumFlagsU16" name="m_objectFlags" value="Opened"/>
159159
<Property type="EnumFlagsU32" name="m_flags" value="Enabled"/>
160160
<Property type="Resource" name="m_meshResource">
161161
<Object class="MeshResource">
@@ -197,16 +197,24 @@
197197
<Property type="String" name="m_resourcePath" value="data/Materials/Cars/SUV/SUV_Glass.mat"/>
198198
<Property type="Bool" name="m_instanciate" value="false"/>
199199
</Object>
200+
<Object class="MaterialResource">
201+
<Property type="String" name="m_name" value="Lights"/>
202+
<Property type="Uint32" name="m_uid" value="3846779952"/>
203+
<Property type="Uint32" name="m_originalUID" value="0"/>
204+
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
205+
<Property type="String" name="m_resourcePath" value="data/Materials/Cars/SUV/SUV_Optics.mat"/>
206+
<Property type="Bool" name="m_instanciate" value="true"/>
207+
</Object>
200208
</Property>
201209
</Object>
202210
</Property>
203-
<Property type="BitMask" name="m_batchMask" BitCount="3" Value="0x0000000000000007"/>
211+
<Property type="BitMask" name="m_batchMask" BitCount="4" Value="0x000000000000000F"/>
204212
</Object>
205213
<Object class="VehicleComponent">
206214
<Property type="String" name="m_name" value="New VehicleComponent"/>
207215
<Property type="Uint32" name="m_uid" value="134844267"/>
208216
<Property type="Uint32" name="m_originalUID" value="0"/>
209-
<Property type="EnumFlagsU16" name="m_objectFlags" value="Opened"/>
217+
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
210218
<Property type="EnumFlagsU32" name="m_flags" value="Enabled"/>
211219
<Property type="Object" name="m_slots">
212220
<Object class="VehicleSlotList">
@@ -222,6 +230,7 @@
222230
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
223231
<Property type="EnumU8" name="m_slotType" value="Driver"/>
224232
<Property type="ObjectHandle" name="m_location" value="2830978027"/>
233+
<Property type="Float" name="m_scale" value="1"/>
225234
<Property type="ObjectHandle" name="m_exit" value="638852780"/>
226235
</Object>
227236
<Object class="VehicleSlot">
@@ -231,6 +240,7 @@
231240
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
232241
<Property type="EnumU8" name="m_slotType" value="Passenger"/>
233242
<Property type="ObjectHandle" name="m_location" value="3314347206"/>
243+
<Property type="Float" name="m_scale" value="1"/>
234244
<Property type="ObjectHandle" name="m_exit" value="1702499998"/>
235245
</Object>
236246
<Object class="VehicleSlot">
@@ -240,6 +250,7 @@
240250
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
241251
<Property type="EnumU8" name="m_slotType" value="Passenger"/>
242252
<Property type="ObjectHandle" name="m_location" value="3430018044"/>
253+
<Property type="Float" name="m_scale" value="1"/>
243254
<Property type="ObjectHandle" name="m_exit" value="1104663694"/>
244255
</Object>
245256
<Object class="VehicleSlot">
@@ -249,6 +260,7 @@
249260
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
250261
<Property type="EnumU8" name="m_slotType" value="Passenger"/>
251262
<Property type="ObjectHandle" name="m_location" value="1302024338"/>
263+
<Property type="Float" name="m_scale" value="1"/>
252264
<Property type="ObjectHandle" name="m_exit" value="2221257942"/>
253265
</Object>
254266
</Property>

‎data/Prefabs/Cars/Sport.prefab‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,18 @@
333333
<Property type="String" name="m_resourcePath" value="data/Materials/Cars/Sport/Glass.mat"/>
334334
<Property type="Bool" name="m_instanciate" value="false"/>
335335
</Object>
336+
<Object class="MaterialResource">
337+
<Property type="String" name="m_name" value="Lights"/>
338+
<Property type="Uint32" name="m_uid" value="1946458111"/>
339+
<Property type="Uint32" name="m_originalUID" value="0"/>
340+
<Property type="EnumFlagsU16" name="m_objectFlags" value=""/>
341+
<Property type="String" name="m_resourcePath" value="data/Materials/Cars/Sport/Optics.mat"/>
342+
<Property type="Bool" name="m_instanciate" value="true"/>
343+
</Object>
336344
</Property>
337345
</Object>
338346
</Property>
339-
<Property type="BitMask" name="m_batchMask" BitCount="3" Value="0x00000000000007FF"/>
347+
<Property type="BitMask" name="m_batchMask" BitCount="4" Value="0x00000000000007FF"/>
340348
</Object>
341349
</Property>
342350
<Property type="ObjectPtrVector" name="m_children">

‎data/Textures/Cars/SUV/lights.jpg.meta‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Property type="String" name="m_name" value="lights.jpg.meta"/>
44
<Property type="EnumU8" name="m_importSettings.m_importerType" value="Auto"/>
55
<Property type="EnumU8" name="m_importSettings.m_importerFormat" value="Auto"/>
6-
<Property type="Bool" name="m_importSettings.m_sRGB" value="false"/>
6+
<Property type="Bool" name="m_importSettings.m_sRGB" value="true"/>
77
<Property type="EnumU8" name="m_importSettings.m_mipLevelCount" value="TextureImporterMip_Auto"/>
88
<Property type="EnumU8" name="m_importSettings.m_downscale" value="None"/>
99
</Object>

‎src/engine/Component/Physics/Constraint/Vehicle/VehicleComponent.hpp‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,12 @@ namespace vg::engine
527527
//--------------------------------------------------------------------------------------
528528
VehicleSlotType VehicleComponent::GetPassengerSlotType(core::uint _index) const
529529
{
530-
return m_slots.getObjects()[_index].m_slotType;
530+
VG_ASSERT(_index < m_slots.getObjects().size());
531+
532+
if (_index < m_slots.getObjects().size())
533+
return m_slots.getObjects()[_index].m_slotType;
534+
535+
return (VehicleSlotType)-1;
531536
}
532537

533538
//--------------------------------------------------------------------------------------
@@ -563,7 +568,6 @@ namespace vg::engine
563568

564569
if (MeshComponent * meshComponent = GetGameObject()->GetComponentT<MeshComponent>())
565570
{
566-
// TODO: Create IMaterialResource interface, make sure returned material is instanciated, and add methods that manipulate material resource and set values to renderer material
567571
const auto matIndex = meshComponent->GetMaterialIndex("Lights");
568572
if (-1 != matIndex)
569573
{
@@ -572,6 +576,10 @@ namespace vg::engine
572576
if (-1 != propIndex)
573577
mat->SetProperty(propIndex, _brake);
574578
}
579+
else
580+
{
581+
VG_WARNING("[Vehicle] Vehicle \"%s\" has no \"%s\" material", GetGameObject()->GetName().c_str(), "Lights");
582+
}
575583
}
576584

577585
m_driveState.m_brake = _brake;

0 commit comments

Comments
 (0)