OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 9 |
10 | 10 |
11 | 11 |
12 // Inspired by Rob Johnson's most excellent QuickDraw GX sample code | 12 // Inspired by Rob Johnson's most excellent QuickDraw GX sample code |
13 | 13 |
14 #ifndef SkCamera_DEFINED | 14 #ifndef SkCamera_DEFINED |
15 #define SkCamera_DEFINED | 15 #define SkCamera_DEFINED |
16 | 16 |
17 #include "Sk64.h" | 17 #include "Sk64.h" |
18 #include "SkMatrix.h" | 18 #include "SkMatrix.h" |
19 | 19 |
20 class SkCanvas; | 20 class SkCanvas; |
21 | 21 |
22 #ifdef SK_SCALAR_IS_FIXED | 22 typedef float SkUnitScalar; |
23 typedef SkFract SkUnitScalar; | 23 #define SK_UnitScalar1 SK_Scalar1 |
24 #define SK_UnitScalar1 SK_Fract1 | 24 #define SkUnitScalarMul(a, b) SkScalarMul(a, b) |
25 #define SkUnitScalarMul(a, b) SkFractMul(a, b) | 25 #define SkUnitScalarDiv(a, b) SkScalarDiv(a, b) |
26 #define SkUnitScalarDiv(a, b) SkFractDiv(a, b) | |
27 #else | |
28 typedef float SkUnitScalar; | |
29 #define SK_UnitScalar1 SK_Scalar1 | |
30 #define SkUnitScalarMul(a, b) SkScalarMul(a, b) | |
31 #define SkUnitScalarDiv(a, b) SkScalarDiv(a, b) | |
32 #endif | |
33 | 26 |
34 struct SkUnit3D { | 27 struct SkUnit3D { |
35 SkUnitScalar fX, fY, fZ; | 28 SkUnitScalar fX, fY, fZ; |
36 | 29 |
37 void set(SkUnitScalar x, SkUnitScalar y, SkUnitScalar z) | 30 void set(SkUnitScalar x, SkUnitScalar y, SkUnitScalar z) |
38 { | 31 { |
39 fX = x; fY = y; fZ = z; | 32 fX = x; fY = y; fZ = z; |
40 } | 33 } |
41 static SkUnitScalar Dot(const SkUnit3D&, const SkUnit3D&); | 34 static SkUnitScalar Dot(const SkUnit3D&, const SkUnit3D&); |
42 static void Cross(const SkUnit3D&, const SkUnit3D&, SkUnit3D* cross); | 35 static void Cross(const SkUnit3D&, const SkUnit3D&, SkUnit3D* cross); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 struct Rec { | 159 struct Rec { |
167 Rec* fNext; | 160 Rec* fNext; |
168 SkMatrix3D fMatrix; | 161 SkMatrix3D fMatrix; |
169 }; | 162 }; |
170 Rec* fRec; | 163 Rec* fRec; |
171 Rec fInitialRec; | 164 Rec fInitialRec; |
172 SkCamera3D fCamera; | 165 SkCamera3D fCamera; |
173 }; | 166 }; |
174 | 167 |
175 #endif | 168 #endif |
OLD | NEW |