mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
[+] Ext_KHR_lights_punctual::Point support
[!] Fix for multple collections, entity names will be written out according to the full hierarchy.
This commit is contained in:
parent
2cf8d5c8f9
commit
889f613610
1 changed files with 24 additions and 14 deletions
|
@ -134,11 +134,6 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p
|
|||
{
|
||||
bin.Seek( attrBv->byteStride - ( 3 * attrAcc->typeSize ), FS_SEEK_CUR );
|
||||
}
|
||||
|
||||
idRandom rnd( i );
|
||||
int r = rnd.RandomInt( 255 ), g = rnd.RandomInt( 255 ), b = rnd.RandomInt( 255 );
|
||||
|
||||
//vtxData[i].abgr = 0xff000000 + ( b << 16 ) + ( g << 8 ) + r;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -232,7 +227,7 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p
|
|||
{
|
||||
bin.Seek( attrBv->byteStride - ( attrib->elementSize * attrAcc->typeSize ), FS_SEEK_CUR );
|
||||
}
|
||||
|
||||
|
||||
mesh->verts[i].SetColor2( PackColor( vec ) );
|
||||
|
||||
}
|
||||
|
@ -358,18 +353,23 @@ void ResolveLight( gltfData* data, idMapEntity* newEntity, gltfNode* node )
|
|||
|
||||
assert( light );
|
||||
|
||||
newEntity->epairs.SetMatrix("rotation", mat3_default);
|
||||
newEntity->epairs.SetVector("_color", light->color);
|
||||
|
||||
switch( gltfExt_KHR_lights_punctual::resolveType( light->type ) )
|
||||
{
|
||||
default:
|
||||
common->Warning("Unsupported Light Type");
|
||||
break;
|
||||
case gltfExt_KHR_lights_punctual::Directional:
|
||||
{
|
||||
|
||||
common->Warning("KHR_lights_punctual::Directional not implemented");
|
||||
break;
|
||||
}
|
||||
case gltfExt_KHR_lights_punctual::Point:
|
||||
{
|
||||
|
||||
newEntity->epairs.SetVector("light_radius", idVec3(light->range) );
|
||||
newEntity->epairs.Set("texture", "lights/defaultpointlight");
|
||||
break;
|
||||
}
|
||||
case gltfExt_KHR_lights_punctual::Spot:
|
||||
|
@ -378,12 +378,9 @@ void ResolveLight( gltfData* data, idMapEntity* newEntity, gltfNode* node )
|
|||
gltfData::ResolveNodeMatrix( node, &entityToWorldTransform );
|
||||
idMat4 worldToEntityTransform = entityToWorldTransform.Inverse();
|
||||
|
||||
float fov = tan( light->spot.outerConeAngle ) / idMath::HALF_PI ;
|
||||
float fov = tan( light->spot.outerConeAngle ) / 2 ;
|
||||
idMat3 axis = idAngles( 0.0f, 90.0f, 90.0f ).ToMat3() * entityToWorldTransform.ToMat3();
|
||||
|
||||
|
||||
newEntity->epairs.SetMatrix( "rotation", mat3_default );
|
||||
newEntity->epairs.SetVector( "_color", light->color );
|
||||
newEntity->epairs.SetVector( "light_target", axis[0] );
|
||||
newEntity->epairs.SetVector( "light_right", axis[1] * -fov );
|
||||
newEntity->epairs.SetVector( "light_up", axis[2] * fov );
|
||||
|
@ -402,9 +399,22 @@ void ResolveEntity( gltfData* data, idMapEntity* newEntity, gltfNode* node )
|
|||
{
|
||||
const char* classname = node->extras.strPairs.GetString( "classname" );
|
||||
|
||||
if( node->name.Length() )
|
||||
if (node->name.Length())
|
||||
{
|
||||
newEntity->epairs.Set( "name", node->name );
|
||||
idStr name;
|
||||
idStrList names;
|
||||
gltfNode* parent = node->parent;
|
||||
while (parent)
|
||||
{
|
||||
names.Alloc() = parent->name;
|
||||
parent = parent->parent;
|
||||
}
|
||||
|
||||
for (int i = names.Num () ; i >= 1 ; i--)
|
||||
{
|
||||
name += names[i-1] + ".";
|
||||
}
|
||||
newEntity->epairs.Set( "name", name+node->name );
|
||||
}
|
||||
|
||||
// copy custom properties filled in Blender
|
||||
|
|
Loading…
Reference in a new issue