Skip to content

Commit 03bbf9a

Browse files
HarrievGRobertBeckebans
authored andcommitted
-Fixed timestamp check while loading a camera animation from a gltf file
- Set gltfCamera fov to framefov during anim # Conflicts: # neo/d3xp/Camera.cpp
1 parent ce050ea commit 03bbf9a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

neo/d3xp/Camera.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ void idCameraAnim::LoadAnim()
425425
ID_TIME_T sourceTimeStamp = currentTimeStamp;
426426

427427

428-
if( ( generatedTimeStamp != FILE_NOT_FOUND_TIMESTAMP ) && ( sourceTimeStamp != 0 ) && ( sourceTimeStamp != generatedTimeStamp ) )
428+
if( ( generatedTimeStamp != FILE_NOT_FOUND_TIMESTAMP ) && ( sourceTimeStamp != 0 ) && ( sourceTimeStamp < generatedTimeStamp ) )
429429
{
430430
idFileLocal file( fileSystem->OpenFileReadMemory( generatedFileName ) );
431431
LoadBinaryCamAnim( file, currentTimeStamp );
@@ -755,11 +755,9 @@ void idCameraAnim::Event_Activate( idEntity* _activator )
755755

756756
void idCameraAnim::gltfLoadAnim( idStr gltfFileName, idStr animName )
757757
{
758-
// we dont want to load the gltb all the time. write custom binary format !
759758
GLTF_Parser gltf;
760759
if( gltf.Load( gltfFileName ) )
761760
{
762-
ID_TIME_T timeStamp = fileSystem->GetTimestamp( gltfFileName );
763761
gltfData* data = gltf.currentAsset;
764762
auto& accessors = data->AccessorList();
765763
auto& nodes = data->NodeList();
@@ -791,7 +789,7 @@ void idCameraAnim::gltfLoadAnim( idStr gltfFileName, idStr animName )
791789
if( !camera.Num() )
792790
{
793791
cameraFrame_t t;
794-
t.fov = 90;
792+
t.fov = data->CameraList()[target->camera]->perspective.yfov * 100.0f;
795793
t.q = mat3_identity.ToCQuat();
796794
t.t = vec3_origin;
797795
for( int i = 0; i < frames; i++ )
@@ -800,11 +798,12 @@ void idCameraAnim::gltfLoadAnim( idStr gltfFileName, idStr animName )
800798
}
801799
}
802800
//This has to be replaced for correct interpolation between frames
801+
// but, if exported with frame sampling set to 1, were all good :D
803802
for( int i = 0; i < frames; i++ )
804803
{
805804
cameraFrame_t& cameraFrame = camera[i];
806805

807-
cameraFrame.fov = 90.0f;
806+
cameraFrame.fov = data->CameraList()[target->camera]->perspective.yfov * 100.0f;
808807
switch( channel->target.TRS )
809808
{
810809
default:
@@ -816,7 +815,6 @@ void idCameraAnim::gltfLoadAnim( idStr gltfFileName, idStr animName )
816815
idList<idQuat*>& values = data->GetAccessorView<idQuat>( output );
817816
if( values.Num() > i )
818817
{
819-
820818
idQuat q = ( *values[i] );
821819
q = idAngles( 90.0f, 0.0, -90.0f ).ToQuat()
822820
* q.Inverse()

0 commit comments

Comments
 (0)