src/render/SDL_d3dmath.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 13 Aug 2017 21:55:42 -0700
changeset 11279 b9b53f45bec6
parent 10737 3406a0f8b041
child 11811 5d94cb6b24d3
permissions -rw-r--r--
Fixed bug 2755 - SDL2 fails to build on Solaris 10 u3

UX-admin

I am compiling with the Sun Studio 12 u2 compiler. There are multiple issues with the build, but this particular issue appears to be that it is illegal to declare a union of a struct of floats and a float. While GCC 4.8.1 does not flag this as an error, Sun Studio is much more standards compliant and strict, halting further compilation with an error.
slouken@8599
     1
/*
slouken@8599
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
slouken@8599
     4
slouken@8599
     5
  This software is provided 'as-is', without any express or implied
slouken@8599
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@8599
     7
  arising from the use of this software.
slouken@8599
     8
slouken@8599
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@8599
    10
  including commercial applications, and to alter it and redistribute it
slouken@8599
    11
  freely, subject to the following restrictions:
slouken@8599
    12
slouken@8599
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@8599
    14
     claim that you wrote the original software. If you use this software
slouken@8599
    15
     in a product, an acknowledgment in the product documentation would be
slouken@8599
    16
     appreciated but is not required.
slouken@8599
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@8599
    18
     misrepresented as being the original software.
slouken@8599
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@8599
    20
*/
slouken@8599
    21
#include "../SDL_internal.h"
slouken@8599
    22
gabomdq@8764
    23
#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED
slouken@8599
    24
slouken@8599
    25
/* Direct3D matrix math functions */
slouken@8599
    26
slouken@8599
    27
typedef struct
slouken@8599
    28
{
slouken@8599
    29
    float x;
slouken@8599
    30
    float y;
slouken@8599
    31
} Float2;
slouken@8599
    32
slouken@8599
    33
typedef struct
slouken@8599
    34
{
slouken@8599
    35
    float x;
slouken@8599
    36
    float y;
slouken@8599
    37
    float z;
slouken@8599
    38
} Float3;
slouken@8599
    39
slouken@8599
    40
typedef struct
slouken@8599
    41
{
slouken@8599
    42
    float x;
slouken@8599
    43
    float y;
slouken@8599
    44
    float z;
slouken@8599
    45
    float w;
slouken@8599
    46
} Float4;
slouken@8599
    47
slouken@8599
    48
typedef struct
slouken@8599
    49
{
slouken@8599
    50
    union {
slouken@8599
    51
        struct {
slouken@8599
    52
            float _11, _12, _13, _14;
slouken@8599
    53
            float _21, _22, _23, _24;
slouken@8599
    54
            float _31, _32, _33, _34;
slouken@8599
    55
            float _41, _42, _43, _44;
slouken@11279
    56
        } v;
slouken@8599
    57
        float m[4][4];
slouken@8599
    58
    };
slouken@8599
    59
} Float4X4;
slouken@8599
    60
slouken@8599
    61
slouken@8599
    62
Float4X4 MatrixIdentity();
slouken@8599
    63
Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2);
slouken@8599
    64
Float4X4 MatrixScaling(float x, float y, float z);
slouken@8599
    65
Float4X4 MatrixTranslation(float x, float y, float z);
slouken@8599
    66
Float4X4 MatrixRotationX(float r);
slouken@8599
    67
Float4X4 MatrixRotationY(float r);
slouken@8599
    68
Float4X4 MatrixRotationZ(float r);
slouken@8599
    69
gabomdq@8764
    70
#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */
gabomdq@8764
    71
slouken@8599
    72
/* vi: set ts=4 sw=4 expandtab: */