-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
120 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
namespace RT | ||
{ | ||
struct Pixel | ||
{ | ||
float r = 0, g = 0, b = 0, a = 0; | ||
|
||
float& operator[](size_t i) | ||
{ | ||
switch (i) { | ||
case 0: | ||
return r; | ||
case 1: | ||
return g; | ||
case 2: | ||
return b; | ||
case 3: | ||
return a; | ||
default: | ||
return r; | ||
} | ||
} | ||
}; | ||
|
||
enum class Format : uint8_t | ||
{ | ||
R8, | ||
RG88, | ||
RGB888, | ||
RGBFFF, | ||
Size, | ||
|
||
Albedo = RGBFFF, | ||
Normal = RGBFFF | ||
}; | ||
|
||
static const uint8_t CHANNELS[static_cast<size_t>(Format::Size)] = { | ||
1, | ||
2, | ||
3, | ||
3 | ||
}; | ||
|
||
static const size_t STRIDES[static_cast<size_t>(Format::Size)] = { | ||
sizeof(uint8_t), | ||
sizeof(uint8_t), | ||
sizeof(uint8_t), | ||
sizeof(float) | ||
}; | ||
|
||
class ITexture | ||
{ | ||
protected: | ||
Format mFormat; | ||
size_t mChannelSize, mPixelSize; | ||
uint8_t* pBuffer = nullptr; | ||
uint16_t mWidth = 0, mHeight = 0; | ||
|
||
public: | ||
ITexture() {}; | ||
virtual ~ITexture() {}; | ||
|
||
virtual bool Resize(uint16_t width, uint16_t height) = 0; | ||
|
||
virtual bool IsValid() const = 0; | ||
virtual uint16_t GetWidth() const = 0; | ||
virtual uint16_t GetHeight() const = 0; | ||
virtual Format GetFormat() const = 0; | ||
|
||
virtual uint8_t* GetRawData() = 0; | ||
virtual size_t GetPixelSize() const = 0; | ||
virtual size_t GetSize() const = 0; | ||
|
||
virtual Pixel GetPixel(uint16_t x, uint16_t y) const = 0; | ||
virtual void SetPixel(uint16_t x, uint16_t y, const Pixel& pixel) = 0; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# VisTrace Includes | ||
|
||
These files can be included without any dependencies for use in your own projects, allowing you to interface with VisTrace objects on the stack | ||
|
||
Use `GetProcAddress` to get metatable type IDs from the VisTrace dll. These are declared in the respective object's header file, and will be -1 if invalid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5218e26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍