Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: include/core/SkPoint3.h

Issue 1255133004: Add SkLights class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Actually add SkLights.h Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkPoint3_DEFINED 8 #ifndef SkPoint3_DEFINED
9 #define SkPoint3_DEFINED 9 #define SkPoint3_DEFINED
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 /** Returns a new point whose coordinates are the sum of a and b (a + b) 92 /** Returns a new point whose coordinates are the sum of a and b (a + b)
93 */ 93 */
94 friend SkPoint3 operator+(const SkPoint3& a, const SkPoint3& b) { 94 friend SkPoint3 operator+(const SkPoint3& a, const SkPoint3& b) {
95 SkPoint3 v; 95 SkPoint3 v;
96 v.set(a.fX + b.fX, a.fY + b.fY, a.fZ + b.fZ); 96 v.set(a.fX + b.fX, a.fY + b.fY, a.fZ + b.fZ);
97 return v; 97 return v;
98 } 98 }
99 99
100 /** Add v's coordinates to the point's
101 */
102 void operator+=(const SkPoint3& v) {
103 fX += v.fX;
104 fY += v.fY;
105 fZ += v.fZ;
106 }
107
108 /** Subtract v's coordinates from the point's
109 */
110 void operator-=(const SkPoint3& v) {
111 fX -= v.fX;
112 fY -= v.fY;
113 fZ -= v.fZ;
114 }
115
100 /** Returns the dot product of a and b, treating them as 3D vectors 116 /** Returns the dot product of a and b, treating them as 3D vectors
101 */ 117 */
102 static SkScalar DotProduct(const SkPoint3& a, const SkPoint3& b) { 118 static SkScalar DotProduct(const SkPoint3& a, const SkPoint3& b) {
103 return a.fX * b.fX + a.fY * b.fY + a.fZ * b.fZ; 119 return a.fX * b.fX + a.fY * b.fY + a.fZ * b.fZ;
104 } 120 }
105 121
106 SkScalar dot(const SkPoint3& vec) const { 122 SkScalar dot(const SkPoint3& vec) const {
107 return DotProduct(*this, vec); 123 return DotProduct(*this, vec);
108 } 124 }
109 }; 125 };
110 126
111 typedef SkPoint3 SkVector3; 127 typedef SkPoint3 SkVector3;
112 typedef SkPoint3 SkColor3f; 128 typedef SkPoint3 SkColor3f;
113 129
114 #endif 130 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698