Skip to content

Commit 66c7a75

Browse files
committed
add print operator for float3
1 parent 4321456 commit 66c7a75

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

RadeonProRender/inc/Math/float3.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVE
1616

1717
#pragma once
1818

19+
#include <iostream>
1920
#include <cmath>
2021
#include <algorithm>
2122

@@ -38,12 +39,18 @@ namespace RadeonProRender
3839
float3& operator *= (float3 const& o) { x*=o.x; y*=o.y; z*= o.z; return *this;}
3940
float3& operator *= (float c) { x*=c; y*=c; z*= c; return *this;}
4041
float3& operator /= (float c) { float cinv = 1.f/c; x*=cinv; y*=cinv; z*=cinv; return *this;}
42+
friend std::ostream& operator<<(std::ostream& os, const float3& o);
4143

4244
float x, y, z, w;
4345
};
4446

4547
typedef float3 float4;
4648

49+
inline std::ostream& operator<<(std::ostream& os, const float3& o)
50+
{
51+
os << "[" << o.x << ", " << o.y << ", " << o.z << ", " << o.w << "]";
52+
return os;
53+
}
4754

4855
inline float3 operator+(float3 const& v1, float3 const& v2)
4956
{

0 commit comments

Comments
 (0)