Skip to content

Commit c24a769

Browse files
author
ParitoshK
committed
Overload ostream operator for float3 type
1 parent db336c8 commit c24a769

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

RadeonProRender/inc/Math/float3.h

Lines changed: 8 additions & 1 deletion
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;}
41-
42+
friend std::ostream& operator<<(std::ostream& os, const float3& o);
43+
4244
float x, y, z, w;
4345
};
4446

4547
typedef float3 float4;
4648

49+
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)