1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0030483: Visualization, Path Tracing - make Tile Size configurable

OpenGl_TileSampler has been refactored to better describe its logic:
- Offset image now defines tile index instead of offset to tile origin.
- Added 2D array defining the number of times to sample tile for straight-forward debugging.

Graphic3d_RenderingParams has been extended with property
RayTracingTileSize for testing various tile configurations.
Default behavior is the following:
- Target number of tiles (e.g. upper limit per frame): 256
- Tile size: 32x32.

OpenGl_View::runPathtrace() has been split into two methods per rendering stage.
OpenGl_Texture::Init() now returns FALSE immediately on 0 input dimensions.

Added Image_PixMapTypedData template class allowing to work with image data of known pixel format.
This commit is contained in:
kgv
2019-02-06 19:21:23 +03:00
committed by apn
parent e607bd3e6b
commit 66d1cdc65d
17 changed files with 569 additions and 482 deletions

View File

@@ -7,5 +7,6 @@ Image_Format.hxx
Image_PixMap.cxx
Image_PixMap.hxx
Image_PixMapData.hxx
Image_PixMapTypedData.hxx
Image_VideoRecorder.cxx
Image_VideoRecorder.hxx

View File

@@ -38,7 +38,7 @@ public:
}
//! Initializer.
void Init (const Handle(NCollection_BaseAllocator)& theAlloc,
bool Init (const Handle(NCollection_BaseAllocator)& theAlloc,
const Standard_Size theSizeBPP,
const Standard_Size theSizeX,
const Standard_Size theSizeY,
@@ -59,6 +59,16 @@ public:
Allocate (mySize);
}
SetTopDown (TopToDown == 1);
return !IsEmpty();
}
//! Reset all values to zeros.
void ZeroData()
{
if (myData != NULL)
{
memset (myData, 0, mySize);
}
}
//! @return data pointer to requested row (first column).

View File

@@ -0,0 +1,64 @@
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Image_PixMapTypedData_Header
#define _Image_PixMapTypedData_Header
#include <Image_PixMapData.hxx>
//! Structure to manage image buffer with predefined pixel type.
template<typename PixelType_t>
class Image_PixMapTypedData : public Image_PixMapData
{
public:
//! Empty constructor.
Image_PixMapTypedData() {}
//! Initializer.
bool Init (const Handle(NCollection_BaseAllocator)& theAlloc,
Standard_Size theSizeX,
Standard_Size theSizeY,
Standard_Size theSizeRowBytes = 0,
Standard_Byte* theDataPtr = 0)
{
const Standard_Size aSizeBPP = sizeof(PixelType_t);
return Image_PixMapData::Init (theAlloc, aSizeBPP, theSizeX, theSizeY, theSizeRowBytes, theDataPtr);
}
//! Reset all values to specified one.
void Init (const PixelType_t& theValue)
{
for (Standard_Size aRowIter = 0; aRowIter < SizeY; ++aRowIter)
{
for (Standard_Size aColIter = 0; aColIter < SizeX; ++aColIter)
{
ChangeValue (aRowIter, aColIter) = theValue;
}
}
}
//! @return data pointer to requested row (first column).
const PixelType_t* Row (Standard_Size theRow) const { return (const PixelType_t* )Image_PixMapData::Row (theRow); }
//! @return data pointer to requested row (first column).
PixelType_t* ChangeRow (Standard_Size theRow) { return (PixelType_t* )Image_PixMapData::ChangeRow (theRow); }
//! @return data pointer to requested position.
const PixelType_t& Value (Standard_Size theRow, Standard_Size theCol) const { return *(const PixelType_t* )Image_PixMapData::Value (theRow, theCol); }
//! @return data pointer to requested position.
PixelType_t& ChangeValue (Standard_Size theRow, Standard_Size theCol) { return *(PixelType_t* )Image_PixMapData::ChangeValue (theRow, theCol); }
};
#endif // _Image_PixMapTypedData_Header