improve rendering and physics
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
{
|
||||
"classname": "prop_physics",
|
||||
"model": "game/core/maps/test/test0.fmdl",
|
||||
"physics": "static"
|
||||
"physics": "static",
|
||||
"origin": [ 0, -10, 0 ]
|
||||
},
|
||||
|
||||
{
|
||||
"classname": "prop_physics",
|
||||
"model": "game/core/models/cube.fmdl",
|
||||
"model": "game/core/models/sphere.fmdl",
|
||||
"physics": "dynamic",
|
||||
"origin": [ 0, 3, 0 ]
|
||||
"origin": [ 0, -5, 0 ]
|
||||
}
|
||||
]
|
||||
|
||||
Binary file not shown.
BIN
funnyassets/meshes/sphere.fmesh_c
Normal file
BIN
funnyassets/meshes/sphere.fmesh_c
Normal file
Binary file not shown.
5
funnyassets/models/sphere.fmdl
Normal file
5
funnyassets/models/sphere.fmdl
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"Mesh": "game/core/meshes/sphere.fmesh_c",
|
||||
"Material": "game/core/materials/cube.fmat",
|
||||
"Physics": "game/core/physics/sphere.fpx"
|
||||
}
|
||||
4
funnyassets/physics/sphere.fpx
Normal file
4
funnyassets/physics/sphere.fpx
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"Type": "Sphere",
|
||||
"Radius": "1.0"
|
||||
}
|
||||
@@ -19,6 +19,7 @@ COMMON {
|
||||
float4 m_vWorldPosition: POSITION;
|
||||
float4 m_vTexCoord: TEXCOORD0;
|
||||
float4 m_vNormal: NORMAL0;
|
||||
uint m_uInstance: SV_InstanceID;
|
||||
}
|
||||
}
|
||||
VS
|
||||
@@ -31,8 +32,10 @@ VS
|
||||
float3 m_vNormal: NORMAL0;
|
||||
}
|
||||
|
||||
PS_INPUT vsMain( VS_INPUT input, uint uInstance: SV_InstanceID )
|
||||
PS_INPUT vsMain( VS_INPUT input, uint uInstance: SV_InstanceID, uint uBaseInstance: SV_StartInstanceLocation )
|
||||
{
|
||||
uint uInstance = uBaseInstance + uInstance;
|
||||
|
||||
PS_INPUT output = {};
|
||||
output.m_vScreenPosition = float4(input.m_vPosition, 1);
|
||||
output.m_vScreenPosition = mul(
|
||||
@@ -53,6 +56,7 @@ VS
|
||||
g_modelData[uInstance].m_matRotation
|
||||
);
|
||||
output.m_vTexCoord = float4(input.m_vTexCoord, 0, 0);
|
||||
output.m_uInstance = uInstance;
|
||||
return output;
|
||||
}
|
||||
}
|
||||
@@ -69,10 +73,10 @@ PS
|
||||
float4 m_vWorldPosition: SV_Target2;
|
||||
}
|
||||
|
||||
PS_OUTPUT psMain( PS_INPUT input, uint uInstance: SV_InstanceID )
|
||||
PS_OUTPUT psMain( PS_INPUT input )
|
||||
{
|
||||
PS_OUTPUT output = {};
|
||||
PerModelData data = g_modelData[uInstance];
|
||||
PerModelData data = g_modelData[input.m_uInstance];
|
||||
output.m_vAlbedo = g_textures[data.m_uAlbedo].Sample(g_textureSampler, input.m_vTexCoord.xy);
|
||||
output.m_vWorldPosition = input.m_vWorldPosition;
|
||||
output.m_vNormal = input.m_vNormal;
|
||||
|
||||
Reference in New Issue
Block a user