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

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

Issue 2239933004: LightingFP now supports multiple directional lights (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Resolved rebase conflicts Created 4 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 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkLights_DEFINED 9 #ifndef SkLights_DEFINED
10 #define SkLights_DEFINED 10 #define SkLights_DEFINED
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (this == &b) { 80 if (this == &b) {
81 return *this; 81 return *this;
82 } 82 }
83 83
84 fColor = b.fColor; 84 fColor = b.fColor;
85 fType = b.fType; 85 fType = b.fType;
86 fDirection = b.fDirection; 86 fDirection = b.fDirection;
87 fShadowMap = b.fShadowMap; 87 fShadowMap = b.fShadowMap;
88 return *this; 88 return *this;
89 } 89 }
90
91 bool operator== (const Light& b) {
92 if (this == &b) {
93 return true;
94 }
95
96 return (fColor == b.fColor) &&
97 (fType == b.fType) &&
98 (fDirection == b.fDirection) &&
99 (fShadowMap == b.fShadowMap);
100 }
101
102 bool operator!= (const Light& b) { return !(this->operator==(b)); }
103
90 private: 104 private:
91 LightType fType; 105 LightType fType;
92 SkColor3f fColor; // linear (unpremul) color. Range is 0..1 in each channel. 106 SkColor3f fColor; // linear (unpremul) color. Range is 0..1 in each channel.
93 SkVector3 fDirection; // For directional lights, holds the direc tion towards the 107 SkVector3 fDirection; // For directional lights, holds the direc tion towards the
94 // light (+Z is out of the screen). 108 // light (+Z is out of the screen).
95 // If degenerate, it will be replaced with (0, 0, 1). 109 // If degenerate, it will be replaced with (0, 0, 1).
96 // For point lights, holds location of poi nt light 110 // For point lights, holds location of poi nt light
97 sk_sp<SkImage> fShadowMap; 111 sk_sp<SkImage> fShadowMap;
98 112
99 Light(LightType type, const SkColor3f& color, const SkVector3& dir) { 113 Light(LightType type, const SkColor3f& color, const SkVector3& dir) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 157
144 void flatten(SkWriteBuffer& buf) const; 158 void flatten(SkWriteBuffer& buf) const;
145 159
146 private: 160 private:
147 SkLights() {} 161 SkLights() {}
148 SkTArray<Light> fLights; 162 SkTArray<Light> fLights;
149 typedef SkRefCnt INHERITED; 163 typedef SkRefCnt INHERITED;
150 }; 164 };
151 165
152 #endif 166 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698