DirectXMath | DirectXMath is an all inline SIMD C++ linear algebra | Game Engine library

 by   microsoft C++ Version: dec2022 License: MIT

kandi X-RAY | DirectXMath Summary

kandi X-RAY | DirectXMath Summary

DirectXMath is a C++ library typically used in Gaming, Game Engine applications. DirectXMath has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Copyright (c) Microsoft Corporation. This package contains the DirectXMath library, an all inline SIMD C++ linear algebra library for use in games and graphics apps. This code is designed to build with Visual Studio 2017, Visual Studio 2019, Visual Studio 2022, or clang/LLVM for Windows. It is recommended that you make use of the latest updates (VS 2017 15.9; VS 2019 16.7 or later). These components are designed to work without requiring any content from the legacy DirectX SDK. For details, see Where is the DirectX SDK?.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              DirectXMath has a medium active ecosystem.
              It has 1329 star(s) with 226 fork(s). There are 94 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 16 open issues and 104 have been closed. On average issues are closed in 467 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of DirectXMath is dec2022

            kandi-Quality Quality

              DirectXMath has no bugs reported.

            kandi-Security Security

              DirectXMath has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              DirectXMath is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              DirectXMath releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of DirectXMath
            Get all kandi verified functions for this library.

            DirectXMath Key Features

            No Key Features are available at this moment for DirectXMath.

            DirectXMath Examples and Code Snippets

            No Code Snippets are available at this moment for DirectXMath.

            Community Discussions

            QUESTION

            How to convert a 3D position in world space to 2D position using DirectXMath
            Asked 2021-May-19 at 20:35

            I want to take advantage of the SSE intrinsics (mostly for the speed advantage) that DirectXMath provides How would i do it? this is the current code im using

            ...

            ANSWER

            Answered 2021-May-19 at 20:35

            If by 2D position you mean screenspace coordinates:

            First transform from local space to world space:

            Source https://stackoverflow.com/questions/67605019

            QUESTION

            Can get the cube to pop up (DirectX 11). Cube is not showing, only screen is being cleared
            Asked 2020-Oct-03 at 19:22

            I am trying to make a simple d3d11 program to rotate a cube. But ultimately the cube doesnt seem to appear. Only the screen is being cleared to blue but the cube doesnot show up. I have been using this as my source: https://docs.microsoft.com/en-us/windows/win32/direct3dgetstarted/getting-started-with-a-directx-game

            The structure of my project is a MainClass.cpp, MainClass.h (Handles window initializtion) DeviceResources.cpp, DeviceResources.h (The Device Resources include device, context, etc.) Renderer.cpp, Renderer.h (The renderer loads geometry and shaders. Most probably this is where i am going wrong)

            Here is my Renderer.h :

            ...

            ANSWER

            Answered 2020-Oct-03 at 19:22

            You're doing invalid memory accesses when reading the vertex and pixel buffers.

            Also, on my computer, both shaders have a dozen of kbytes whilst the memory buffer you're reading them to has only 4096 bytes.

            To fix your problem, increase the size of the memory buffer you're using to read the shader bytecode from disk and don't forget to update the elementcount in fread_s().

            e.g.,

            Renderer.cpp @ 35

            Source https://stackoverflow.com/questions/64186865

            QUESTION

            XMVECTOR in DirectX
            Asked 2020-Mar-12 at 04:24

            Sorry for the dumb question .... but why this does not work ? To show the problem I wrote this simple code:

            ...

            ANSWER

            Answered 2020-Mar-11 at 23:11

            You should use XMVectorSet instead of XMVECTORSet(This function does not exist)

            Function definition on msdn

            Source https://stackoverflow.com/questions/60645502

            QUESTION

            Undefined identifiers - which header files are missing? - DX12
            Asked 2019-Aug-21 at 04:04

            I am trying to play with the new DX12 API and I have found and copied some code from the Microsoft Documentations regarding it but after copying the code many functions are still being unidentified.

            I have been searching the documentations in detail but I am unable to find the right headers for them. Headers that I have included are the following:

            ...

            ANSWER

            Answered 2019-Aug-21 at 04:04

            Those functions are 'helpers' included in various starter templates and samples, but are not part of the actual Windows APIs in the Windows SDK. In particular, you will see them in the samples from the official DirectX 12 Samples GitHub for Win32 desktop.

            • ThrowIfFailed is a simple "if COM returned a failure, throw a C++ exception" helper. This is because you should always check the return value of any COM function that returns HRESULT instead of void, but in 'working' programs most of the time any failure code from Direct3D in many places is a 'fast-fatal' error. The 'official' desktop samples for DX12 define it in DXSampleHelper.h, but many other templates put it into the pch.h precompiled header to make sure it's defined globally. See this wiki page for more details.

            • GetHardwareAdapter is another helper. When you create a DirectX 11 device on any modern versions of Windows, you can pretty safely assume there's some Direct3D adapter there depending on your minimum Direct3D Hardware Feature level. With DirectX 12, you really need to check as it's quite possible that you have both a DX11 and a DX12 capable device on your system. See this blog post for more details on creating a DirectX 12 device.

            • The Win32Application namespace is just a really simple WndProc and window helper. You can see the implementation here cpp / h

            • GetAssetFullPath is another helper, but this one is more specific to the 'official' DirectX 12 samples. It basically deals with the fact that when doing development in Visual Studio, the 'current working directory' is typically the project folder, but the various shader blobs (cso files) built by Visual Studio are found next to the EXE in Debug, Release, etc. You can find it here.

            This is a 'quirk' of Win32 desktop development since there's no standard packaging/setup/deployment system. For UWP and Xbox One development, the packaging typically places the EXE and CSO files next to each other along with other assets, and the Current Working Directory is set to the root of the 'package' at runtime.

            Personally, I deal with the same issue slightly differently in my ReadData helper.

            Another common issue is that the various D3DX12* helper functions are also not part of the Windows SDK. Instead you get D3DX12.H as part of a DirectX project template or from GitHub. The documentation is on Microsoft Docs.

            I have a set of DirectX basic templates for Visual C++ hosted on GitHub you might want to look at. They include the DeviceResources module for handling your basic DirectX device when you are just getting started, the StepTimer helper, as well as D3DX12.h.

            See this blog post and DirectX Tool Kit for DX12 for some general tips.

            If you are really new to DirectX, you should seriously consider working with DirectX 11 before tackling DirectX 12.

            Source https://stackoverflow.com/questions/57569047

            QUESTION

            DirectX::XMMATRIX Multiplication incorrect after function pass (C++)
            Asked 2019-Jun-13 at 22:03

            I am having some trouble understanding why I am getting different results when multiplying two DirectX 4x4 matrices together, depending on whether the multiplication is performed within a class function or not.

            Using identity matrices as an example, the values of result1 and result2 end up being different using the following code.

            ...

            ANSWER

            Answered 2019-May-09 at 06:46

            TL;DR: This is a compiler bug likely due to bad code-generation.

            The weird output happens only when using the x86 (32-bit) compiler, not when using the x64 (64-bit) native compiler. I tried a few different ways of outputting the results, and they are consistently weird for x86 but correct for x64.

            • It seems to happen in both Debug and Release (optimized) configurations, and with both /fp:fast and /fp:precise.

            • This does not happen with x64 native code or with x86 if you use /arch:IA32.

            • I'm able to reproduce the same issue with VS 2017 (15.9.11) as well as VS 2019 (16.0.3).

            Source https://stackoverflow.com/questions/56039614

            QUESTION

            GXMVECTOR - Documentation?
            Asked 2019-Apr-22 at 20:28

            I am trying to re-learn directx after a decade of doing other things. I read a tutorial on the github wiki on how to render some sprites:

            https://github.com/Microsoft/DirectXTK/wiki/Sprites-and-textures

            In the Draw method it uses 'DirectX::SpriteBatch::Draw' and one of the overloads seems to have a parameters for an 'FXMVECTOR' and 'GXMVECTOR'. I managed to find some documentation for the former, but can't find any for the latter.

            Can anyone tell me where to look? Is it part of DirectXMath or something else?

            ...

            ANSWER

            Answered 2019-Apr-22 at 20:28

            When you see FXMVECTOR, CXMVECTOR, GXMVECTOR, or HXMVECTOR just read XMVECTOR. Same for FXMMATRIX and CXMMATRIX vs. XMMATRIX. It's just some typedef magic stuff I had to do to support the various calling conventions for x86 __fastcall, x64 __fastcall, x86/x64 __vectorcall, and Windows on ARM which are all subtlety different.

            For documentation details on these types, see Microsoft Docs.

            If you are new to DirectXMath, you probably want to take a look at the Simple Math wrapper in the DirectX Tool Kit.

            Source https://stackoverflow.com/questions/55795070

            QUESTION

            XMVECTOR weird values
            Asked 2019-Mar-07 at 00:49

            Starting out with DirectX and messing around with XMVECTORs

            (I know I don't use them in context, I'm just curious)

            ...

            ANSWER

            Answered 2019-Mar-07 at 00:49

            The underlying SIMD instructions are typeless. You can treat the same data as 4 floats or as 4 integers (or 8 shorts or 16 bytes). DirectXMath usually works with 4 floats, which is what your XMVECTOR is getting from XMVectorSet.

            If you used float x = XMVectorGetX(vector); you'd get "1.0" back.

            Alternatively, you could have used XMVECTOR vector = XMVectorSetInt(1, 2, 3, 1);

            See DirectXMath Programmer's Guide as well as the GitHub project.

            Source https://stackoverflow.com/questions/55029515

            QUESTION

            C++ template related error with XMVectorPermute
            Asked 2019-Feb-16 at 18:04

            I'm new to DirectX11 and I'm trying to adapt a file written using DirectX Legacy to new DirectX but I'm having some trouble with template XMVectorPermute, which used to be a function in Legacy file.

            I'm trying to make compiler recognize the template in DirectXMath.h:

            ...

            ANSWER

            Answered 2019-Feb-15 at 23:03

            There are a couple of issues here that are causing your code to fail.

            First, you cannot use a member of an XMVECTORI32 to provide a template parameter to XMVectorPermute. This is not because of the type difference (same thing happens with XMVECTORU32). I believe the issue is because the array i is not declared as const, and the value must be constant to be used as a template parameter. In any case, VS2017 refuses to compile the code.

            Second, you cannot specialize a template function without providing a body for that function. This would mean your second line is incomplete, and would need to have an implementation written by you in order to compile.

            This doesn't mean you're SOL though, just that you need to change your approach. If the template parameters are always constant (and it looks like they should be, in your code), you can define a function that takes the two vector parameters and specifies the exact permute constants to use for that particular operation.

            The following code is an example of this:

            Source https://stackoverflow.com/questions/54702933

            QUESTION

            C++ [D3D11] - Weird behavior, function is called 2 times
            Asked 2018-Aug-17 at 04:08

            THE SCENE:
            So, I have been learning D3D11 programming for the last 15 days now using "3d game programming with DirectX11" book by Frank Luna. I had done pretty well upto now. But because the book uses a deprecated D3DX11 library, I had to devise my own functions as replacement.

            One of it is a function to compile shaders. It is like this-
            Helpers.cpp

            ...

            ANSWER

            Answered 2018-Aug-15 at 11:54

            Lets look at the HR macro:

            Source https://stackoverflow.com/questions/51858139

            QUESTION

            Access floats of CXMMatrix - () operator not working
            Asked 2018-Apr-30 at 17:08

            I'm trying to use updated codes of "Frank Luna" book on directX11 where I using VS2017 with WindowsSDK10. I've read some notes about migration from Frank and did eveything he said in the link below : http://www.d3dcoder.net/Data/Book4/d3d11Win10.htm

            but got stuck here . I know there was same question from @poncho and answered well : Access floats of XMMatrix - () operator not working

            But I have trouble with type CXMMATRIX instead of XMMATRIX and I couldn't get result with the solution provided for him.

            So I have to access the rows and columns of an CXMMATRIX :

            ...

            ANSWER

            Answered 2018-Apr-30 at 17:08

            Frank Luna's book is overall a great introduction to the Direct 11 API, but unfortunately suffers from heavily utilizing the legacy DirectX SDK which is deprecated per MSDN. One of those aspects is that he's actually using the xnamath library (a.k.a. xboxmath version 2) instead of the DirectXMath library (a.k.a. xboxmath version 3)

            See Book Recommendations and Introducing DirectXMath

            I made a number of changes when reworking the library as DirectXMath. First, the types are actually in C++ namespaces instead of the global namespace. In your headers, you should use full name specification:

            Source https://stackoverflow.com/questions/50087843

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install DirectXMath

            You can download it from GitHub.

            Support

            Documentation is available on the Microsoft Docs. Additional information can be found on the project wiki.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Game Engine Libraries

            godot

            by godotengine

            phaser

            by photonstorm

            libgdx

            by libgdx

            aseprite

            by aseprite

            Babylon.js

            by BabylonJS

            Try Top Libraries by microsoft

            vscode

            by microsoftTypeScript

            PowerToys

            by microsoftC#

            TypeScript

            by microsoftTypeScript

            terminal

            by microsoftC++

            Web-Dev-For-Beginners

            by microsoftJavaScript