Moved sendstream to GM tick

This commit is contained in:
doterop 2020-07-30 16:58:09 +02:00 committed by bernat
parent 158247ddb5
commit dea15ec319
3 changed files with 6 additions and 4 deletions

View File

@ -218,6 +218,8 @@ void ACarlaGameModeBase::Tick(float DeltaSeconds)
{
Recorder->Tick(DeltaSeconds);
}
SendAtlas();
}
void ACarlaGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
@ -451,8 +453,6 @@ void ACarlaGameModeBase::CaptureAtlas()
This->AtlasImage,
FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX));
This->SendAtlas();
}
);

View File

@ -561,6 +561,8 @@ bool ASceneCaptureSensor::CopyTextureFromAtlas(
uint32 AtlasTextureWidth)
{
Buffer.reset(Offset + ImageWidth * ImageHeight * sizeof(FColor));
// Check that the atlas alreay contains our texture
// and our image has been initialized
uint32 ExpectedSize = (uint32)(PositionInAtlas.Y * AtlasTextureWidth + ImageWidth * ImageHeight);
@ -579,7 +581,6 @@ bool ASceneCaptureSensor::CopyTextureFromAtlas(
const uint32 DstStride = ImageWidth * sizeof(FColor);
const uint32 SrcStride = AtlasTextureWidth * sizeof(FColor);
Buffer.reset(Offset + ImageHeight * DstStride);
for(uint32 i = 0; i < ImageHeight; i++)
{
Buffer.copy_from(Dest, Source, DstStride);

View File

@ -284,7 +284,8 @@ public:
auto Stream = GetDataStream(Sensor);
carla::Buffer Buffer = Stream.PopBufferFromPool();
if(CopyTextureFromAtlas(Buffer, AtlasImage, AtlasTextureWidth))
CopyTextureFromAtlas(Buffer, AtlasImage, AtlasTextureWidth);
{
SCOPE_CYCLE_COUNTER(STAT_CarlaSensorStreamSend);
Stream.Send(Sensor, std::move(Buffer));