model_data_texture_map.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
29 #pragma once
30 
31 #include "model_data_animation_data.h"
32 
33 namespace clan
34 {
35 
38 {
39 public:
40  enum WrapMode
41  {
45  };
46 
48 
49  int texture;
50  int channel;
51 
53 
57 
58  Mat4f get_uvw_matrix(int animation_index, float animation_time)
59  {
60  if (channel != -1 && texture != -1)
61  return
62  Mat4f::translate(uvw_offset.get_value(animation_index, animation_time)) *
63  Mat4f::scale(uvw_scale.get_value(animation_index, animation_time)) *
64  uvw_rotation.get_value(animation_index, animation_time).to_matrix();
65  else
66  return Mat4f::identity();
67  }
68 
69 };
70 
71 }
72 
int texture
Definition: model_data_texture_map.h:49
Definition: model_data_texture_map.h:44
Definition: model_data_texture_map.h:42
ModelDataAnimationData< Vec3f > uvw_scale
Definition: model_data_texture_map.h:56
static Mat4< Type > identity()
Create the identity matrix.
Definition: mat4.h:496
WrapMode
Definition: model_data_texture_map.h:40
Mat4f get_uvw_matrix(int animation_index, float animation_time)
Definition: model_data_texture_map.h:58
Definition: model_data_texture_map.h:43
WrapMode wrap_x
Definition: model_data_texture_map.h:52
ModelDataTextureMap()
Definition: model_data_texture_map.h:47
Texture sampler state and UVW animation data used when drawing vertex elements.
Definition: model_data_texture_map.h:37
WrapMode wrap_y
Definition: model_data_texture_map.h:52
static Mat4< Type > scale(Type x, Type y, Type z)
Create a scale matrix.
static Mat4< Type > translate(Type x, Type y, Type z)
Create a translation matrix.
ModelDataAnimationData< Quaternionf > uvw_rotation
Definition: model_data_texture_map.h:55
4D matrix
Definition: mat2.h:52
int channel
Definition: model_data_texture_map.h:50
ModelDataAnimationData< Vec3f > uvw_offset
Definition: model_data_texture_map.h:54
Stores different values for different animation timelines.
Definition: model_data_animation_data.h:44