OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/services/geometry/cpp/geometry_util.h" |
| 6 |
| 7 #include <string.h> |
| 8 |
| 9 namespace mojo { |
| 10 |
| 11 static const float kIdentityMatrix[]{ |
| 12 1.f, 0.f, 0.f, 0.f, // comments to prevent |
| 13 0.f, 1.f, 0.f, 0.f, // auto formatter reflow |
| 14 0.f, 0.f, 1.f, 0.f, // |
| 15 0.f, 0.f, 0.f, 1.f}; |
| 16 |
| 17 void SetIdentityTransform(Transform* transform) { |
| 18 transform->matrix.resize(16u); |
| 19 memcpy(transform->matrix.data(), kIdentityMatrix, sizeof(kIdentityMatrix)); |
| 20 } |
| 21 |
| 22 void SetTranslationTransform(Transform* transform, float x, float y, float z) { |
| 23 SetIdentityTransform(transform); |
| 24 transform->matrix[3] = x; |
| 25 transform->matrix[7] = y; |
| 26 transform->matrix[11] = z; |
| 27 } |
| 28 |
| 29 } // namespace mojo |
OLD | NEW |