Fixed clean texture and sendPixels now is on the same frame
This commit is contained in:
parent
ac76cbb71a
commit
158247ddb5
|
@ -69,11 +69,14 @@ void ACarlaGameModeBase::AddSceneCaptureSensor(ASceneCaptureSensor* SceneCapture
|
|||
|
||||
void ACarlaGameModeBase::RemoveSceneCaptureSensor(ASceneCaptureSensor* SceneCaptureSensor)
|
||||
{
|
||||
FlushRenderingCommands();
|
||||
|
||||
// Remove camera
|
||||
SceneCaptureSensors.Remove(SceneCaptureSensor);
|
||||
|
||||
// Recalculate PositionInAtlas for each camera
|
||||
AtlasTextureWidth = 0u;
|
||||
CurrentAtlasTextureHeight = 0u;
|
||||
for(ASceneCaptureSensor* Camera : SceneCaptureSensors)
|
||||
{
|
||||
Camera->PositionInAtlas = FIntVector(0, CurrentAtlasTextureHeight, 0);
|
||||
|
@ -81,7 +84,7 @@ void ACarlaGameModeBase::RemoveSceneCaptureSensor(ASceneCaptureSensor* SceneCapt
|
|||
|
||||
if(AtlasTextureWidth < Camera->ImageWidth)
|
||||
{
|
||||
AtlasTextureWidth = ImageWidth;
|
||||
AtlasTextureWidth = Camera->ImageWidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -409,6 +412,7 @@ void ACarlaGameModeBase::CaptureAtlas()
|
|||
if(!IsAtlasTextureValid)
|
||||
{
|
||||
CreateAtlasTextures();
|
||||
return;
|
||||
}
|
||||
|
||||
// Enqueue the commands to copy the captures to the atlas
|
||||
|
@ -446,10 +450,12 @@ void ACarlaGameModeBase::CaptureAtlas()
|
|||
Rect,
|
||||
This->AtlasImage,
|
||||
FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX));
|
||||
|
||||
This->SendAtlas();
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
SendAtlas();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ inline FAsyncDataStreamTmpl<T>::FAsyncDataStreamTmpl(
|
|||
StreamType InStream)
|
||||
: Stream(std::move(InStream)),
|
||||
Header([&Sensor, Timestamp]() {
|
||||
check(IsInGameThread());
|
||||
//check(IsInGameThread());
|
||||
using Serializer = carla::sensor::s11n::SensorHeaderSerializer;
|
||||
return Serializer::Serialize(
|
||||
carla::sensor::SensorRegistry::template get<SensorT*>::index,
|
||||
|
|
|
@ -279,11 +279,12 @@ public:
|
|||
template <typename TSensor>
|
||||
void SendPixelsInStream(TSensor &Sensor, const TArray<FColor>& AtlasImage, uint32 AtlasTextureWidth)
|
||||
{
|
||||
auto Stream = GetDataStream(Sensor);
|
||||
auto Buffer = Stream.PopBufferFromPool();
|
||||
if (Sensor.HasActorBegunPlay() && !Sensor.IsPendingKill()) {
|
||||
|
||||
if(CopyTextureFromAtlas(Buffer, AtlasImage, AtlasTextureWidth))
|
||||
{
|
||||
auto Stream = GetDataStream(Sensor);
|
||||
carla::Buffer Buffer = Stream.PopBufferFromPool();
|
||||
|
||||
if(CopyTextureFromAtlas(Buffer, AtlasImage, AtlasTextureWidth))
|
||||
{
|
||||
SCOPE_CYCLE_COUNTER(STAT_CarlaSensorStreamSend);
|
||||
Stream.Send(Sensor, std::move(Buffer));
|
||||
|
|
Loading…
Reference in New Issue