omni/core/Types.h

File members: omni/core/Types.h

// Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once

#include "OmniAttr.h"
#include "../../carb/Types.h"

#ifndef DOXYGEN_SHOULD_SKIP_THIS
CARB_IGNOREWARNING_MSC_WITH_PUSH(4201) // nonstandard extension used: nameless struct/union
#endif

namespace omni
{
namespace core
{

union OMNI_ATTR("vec") UInt2
{
    OMNI_ATTR("no_py") uint32_t data[2]; // must be first for proper { } initialization

    struct
    {
        union
        {
            OMNI_ATTR("init_arg") uint32_t x;
            uint32_t u;
            uint32_t s;
            uint32_t w;
        };

        union
        {
            OMNI_ATTR("init_arg") uint32_t y;
            uint32_t v;
            uint32_t t;
            uint32_t h;
        };
    };
};

static_assert(sizeof(UInt2) == (sizeof(uint32_t) * 2), "unexpected UInt2 size");

union OMNI_ATTR("vec") Int2
{
    OMNI_ATTR("no_py") int32_t data[2]; // must be first for proper { } initialization

    struct
    {
        union
        {
            OMNI_ATTR("init_arg") int32_t x;
            int32_t u;
            int32_t s;
            int32_t w;
        };

        union
        {
            OMNI_ATTR("init_arg") int32_t y;
            int32_t v;
            int32_t t;
            int32_t h;
        };
    };
};

static_assert(sizeof(Int2) == (sizeof(int32_t) * 2), "unexpected Int2 size");

union OMNI_ATTR("vec") Float2
{
    OMNI_ATTR("no_py") float data[2]; // must be first for proper { } initialization

    struct
    {
        union
        {
            OMNI_ATTR("init_arg") float x;
            float u;
            float s;
            float w;
        };

        union
        {
            OMNI_ATTR("init_arg") float y;
            float v;
            float t;
            float h;
        };
    };
};

static_assert(sizeof(Float2) == (sizeof(float) * 2), "unexpected Float2 size");

} // namespace core
} // namespace omni

#ifndef DOXYGEN_SHOULD_SKIP_THIS
CARB_IGNOREWARNING_MSC_POP
#endif

#include "Types.gen.h"