Skip to content

Commit

Permalink
Merge from 'develop' into 'main' for CLOiSim-4.9.5 (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunseok-yang authored Dec 17, 2024
2 parents 54bdba7 + 06f928b commit e8a2955
Show file tree
Hide file tree
Showing 40 changed files with 479 additions and 206 deletions.
8 changes: 0 additions & 8 deletions Assets/Resources/Meshes.meta

This file was deleted.

Empty file removed Assets/Resources/Meshes/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MonoBehaviour:
m_SupportsTerrainHoles: 0
m_SupportsHDR: 1
m_HDRColorBufferPrecision: 0
m_MSAA: 4
m_MSAA: 1
m_RenderScale: 1
m_UpscalingFilter: 0
m_FsrOverrideSharpness: 0
Expand Down Expand Up @@ -84,7 +84,7 @@ MonoBehaviour:
blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3}
bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3}
m_PrefilteringModeMainLightShadows: 3
m_PrefilteringModeAdditionalLight: 0
m_PrefilteringModeAdditionalLight: 4
m_PrefilteringModeAdditionalLightShadows: 2
m_PrefilterXRKeywords: 1
m_PrefilteringModeForwardPlus: 1
Expand Down
147 changes: 147 additions & 0 deletions Assets/Resources/Shader/UnlitVideoTexture.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

Shader "Custom/Unlit/VideoTexture"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100

Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog

#include "UnityCG.cginc"

struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};

struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};

sampler2D _MainTex;
float4 _MainTex_ST;

v2f vert (appdata v)
{
v2f o;

o.vertex = UnityObjectToClipPos(v.vertex);

// rotating UV
const float Deg2Rad = (UNITY_PI * 2.0) / 360.0;
const float Rotation = 90.0;

float rotationRadians = Rotation * Deg2Rad; // convert degrees to radians
float s = sin(rotationRadians); // sin and cos take radians, not degrees
float c = cos(rotationRadians);

float2x2 rotationMatrix = float2x2( c, -s, s, c); // construct simple rotation matrix
v.uv -= 0.5; // offset UV so we rotate around 0.5 and not 0.0
v.uv = mul(rotationMatrix, v.uv); // apply rotation matrix
v.uv += 0.5; // offset UV again so UVs are in the correct location

o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv);
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}


// Shader "Example/URPUnlitShaderTexture"
// {
// // The _BaseMap variable is visible in the Material's Inspector, as a field
// // called Base Map.
// Properties
// {
// _BaseMap("Base Map", 2D) = "white"
// }

// SubShader
// {
// Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalRenderPipeline" }

// Pass
// {
// HLSLPROGRAM
// #pragma vertex vert
// #pragma fragment frag

// #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"

// struct Attributes
// {
// float4 positionOS : POSITION;
// // The uv variable contains the UV coordinate on the texture for the
// // given vertex.
// float2 uv : TEXCOORD0;
// };

// struct Varyings
// {
// float4 positionHCS : SV_POSITION;
// // The uv variable contains the UV coordinate on the texture for the
// // given vertex.
// float2 uv : TEXCOORD0;
// };

// // This macro declares _BaseMap as a Texture2D object.
// TEXTURE2D(_BaseMap);
// // This macro declares the sampler for the _BaseMap texture.
// SAMPLER(sampler_BaseMap);

// CBUFFER_START(UnityPerMaterial)
// // The following line declares the _BaseMap_ST variable, so that you
// // can use the _BaseMap variable in the fragment shader. The _ST
// // suffix is necessary for the tiling and offset function to work.
// float4 _BaseMap_ST;
// CBUFFER_END

// Varyings vert(Attributes IN)
// {
// Varyings OUT;
// OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
// // The TRANSFORM_TEX macro performs the tiling and offset
// // transformation.
// OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
// return OUT;
// }

// half4 frag(Varyings IN) : SV_Target
// {
// // The SAMPLE_TEXTURE2D marco samples the texture with the given
// // sampler.
// half4 color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, IN.uv);
// return color;
// }
// ENDHLSL
// }
// }
// }
9 changes: 9 additions & 0 deletions Assets/Resources/Shader/UnlitVideoTexture.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Assets/Scripts/CLOiSimPlugins/ActorControlPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class ActorControlPlugin : CLOiSimPlugin
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.ACTOR;
partsName = "ActorControlPlugin";
_modelName = "World";
_partsName = this.GetType().Name;

UpdateActorList();
}
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/CLOiSimPlugins/ActorPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class ActorPlugin : CLOiSimPlugin
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.ACTOR;
partsName = "actorplugin";
_modelName = "World";
_partsName = this.GetType().Name;
}

protected override void OnStart()
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/CLOiSimPlugins/CameraPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ protected override void OnAwake()
}

if (!string.IsNullOrEmpty(deviceName))
{
attachedDevices.Add(deviceName, _cam);

partsName = DeviceHelper.GetPartName(gameObject);
}
}

protected override void OnStart()
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/CLOiSimPlugins/ElevatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public ElevatorTask(in string index = "")
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.ELEVATOR;
partsName = "elevator_system";
_modelName = "World";
_partsName = this.GetType().Name;
}

protected override void OnStart()
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/CLOiSimPlugins/GpsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class GpsPlugin : CLOiSimPlugin
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.GPS;

gps = gameObject.GetComponent<SensorDevices.GPS>();
attachedDevices.Add("GPS", gps);
partsName = DeviceHelper.GetPartName(gameObject);
}

protected override void OnStart()
Expand Down
5 changes: 2 additions & 3 deletions Assets/Scripts/CLOiSimPlugins/GroundTruthPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ private UE.GameObject GetTrackingObject(in string modelName)
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.GROUNDTRUTH;

modelName = "GroundTruth";
partsName = "tracking";
_modelName = "World";
_partsName = this.GetType().Name;

var worldRoot = Main.WorldRoot;
foreach (var model in worldRoot.GetComponentsInChildren<SDF.Helper.Model>())
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/CLOiSimPlugins/ImuPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class ImuPlugin : CLOiSimPlugin
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.IMU;

imu = gameObject.GetComponent<SensorDevices.IMU>();
attachedDevices.Add("IMU", imu);
partsName = DeviceHelper.GetPartName(gameObject);
}

protected override void OnStart()
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/CLOiSimPlugins/JointControlPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class JointControlPlugin : CLOiSimPlugin
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.JOINTCONTROL;

jointState = gameObject.AddComponent<SensorDevices.JointState>();
jointCommand = gameObject.AddComponent<SensorDevices.JointCommand>();
jointCommand.SetJointState(jointState);
Expand Down
1 change: 0 additions & 1 deletion Assets/Scripts/CLOiSimPlugins/LaserPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class LaserPlugin : CLOiSimPlugin
protected override void OnAwake()
{
type = ICLOiSimPlugin.Type.LASER;
partsName = DeviceHelper.GetPartName(gameObject);

lidar = GetComponent<SensorDevices.Lidar>();
attachedDevices.Add("LIDAR", lidar);
Expand Down
Loading

0 comments on commit e8a2955

Please sign in to comment.