directx11 – Instance D3D11 – Help to send instance data using two vertex buffers. First, for position and color and Second, for matrix data by instance

So here is the premise:

I have 2 vertex buffers buffers whose data and the corresponding definition are as follows:

Vertex 1: this contains the data per instance

// Somewhere defined in the header
std::vector instancedMeshTransformMatrixArray;

...// Following code is in a function called loading data

// We will compute and setup the buffer with the information of the indexed mesh here
static float angle = 0.0f;
//angle += 90.0f * deltaTime;
XMVECTOR rotationAxis = XMVectorSet(0, 1, 1, 0);

g_WorldMatrix = XMMatrixIdentity();
XMMATRIX scale = XMMatrixScaling(1.0f, 1.0f, 1.0f);
XMMATRIX rotate = XMMatrixRotationAxis(rotationAxis, XMConvertToRadians(angle));
XMMATRIX translate = XMMatrixTranslation(0.8, 0.0f, 0.0f);
g_WorldMatrix *= translate  * rotate * scale;

// We will also fill/process the matrix buffer here that will be used to index into to rendered indexed mesh
instancedMeshTransformMatrixArray.push_back(g_WorldMatrix);

// create and initialize the instanced data buffer 
D3D11_BUFFER_DESC vertexInstancedBufferDesc = {};
vertexInstancedBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexInstancedBufferDesc.ByteWidth = sizeof(XMMATRIX) * instancedMeshTransformMatrixArray.size();
vertexInstancedBufferDesc.CPUAccessFlags = 0;
vertexInstancedBufferDesc.Usage = D3D11_USAGE_DEFAULT;

D3D11_SUBRESOURCE_DATA resourceData = {};
//ZeroMemory(&resourceData, sizeof(D3D11_SUBRESOURCE_DATA));

resourceData.pSysMem = &instancedMeshTransformMatrixArray(0);

HRESULT hr = g_d3dDevice->CreateBuffer(&vertexInstancedBufferDesc, &resourceData, &g_d3dIndexedVertexBuffer);
if (FAILED(hr))
{
    return false;
}

Vertex 2: contains data by model

// Somewhere in the header
// Vertex data for a colored cube.
struct VertexPosColor
{
    XMFLOAT3 Position;
    XMFLOAT3 Color;
};

VertexPosColor g_Vertices(8) =
{
    { XMFLOAT3(-0.5f, -0.5f, -0.5f), XMFLOAT3(0.0f, 0.0f, 0.0f) }, // 0
    { XMFLOAT3(-0.5f,  0.5f, -0.5f), XMFLOAT3(0.0f, 1.0f, 0.0f) }, // 1
    { XMFLOAT3(0.5f,  0.5f, -0.5f), XMFLOAT3(1.0f, 1.0f, 0.0f) }, // 2
    { XMFLOAT3(0.5f, -0.5f, -0.5f), XMFLOAT3(1.0f, 0.0f, 0.0f) }, // 3
    { XMFLOAT3(-0.5f, -0.5f,  0.5f), XMFLOAT3(0.0f, 0.0f, 1.0f) }, // 4
    { XMFLOAT3(-0.5f,  0.5f,  0.5f), XMFLOAT3(0.0f, 1.0f, 1.0f) }, // 5
    { XMFLOAT3(0.5f,  0.5f,  0.5f), XMFLOAT3(1.0f, 1.0f, 1.0f) }, // 6
    { XMFLOAT3(0.5f, -0.5f,  0.5f), XMFLOAT3(1.0f, 0.0f, 1.0f) }  // 7
};

...//Following code is in a function called loading data
   //It is followed by the loading of data for Vertex 1

// Create and initialize the vertex buffer.
D3D11_BUFFER_DESC vertexBufferDesc = {};
//ZeroMemory(&vertexBufferDesc, sizeof(D3D11_BUFFER_DESC));

vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.ByteWidth = sizeof(VertexPosColor) * _countof(g_Vertices);
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;

resourceData.pSysMem = g_Vertices;

hr = g_d3dDevice->CreateBuffer(&vertexBufferDesc, &resourceData, &g_d3dVertexBuffer);
if (FAILED(hr))
    {
    return false;
}

I'm also loading data for the index buffer and the constant buffer. I tested it with the VS Graphics debugger and the data seems to be loaded correctly. However, I can also explain to you how I do it if necessary.

Here is how to create the entry descent for the 2 buffers:

// Create the input layout for the vertex shader.
D3D11_INPUT_ELEMENT_DESC vertexLayoutDesc() = {
// Per vertex data
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(VertexPosColor,Position), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(VertexPosColor,Color), D3D11_INPUT_PER_VERTEX_DATA, 0 },

// Instanced Data
{ "INSTANCED_MATS", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_INSTANCE_DATA, 1},
{ "INSTANCED_MATS", 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 16, D3D11_INPUT_PER_INSTANCE_DATA, 1},
{ "INSTANCED_MATS", 2, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 32, D3D11_INPUT_PER_INSTANCE_DATA, 1},
{ "INSTANCED_MATS", 3, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 64, D3D11_INPUT_PER_INSTANCE_DATA, 1}

};

hr = g_d3dDevice->CreateInputLayout(vertexLayoutDesc, _countof(vertexLayoutDesc), vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_d3dInputLayout);
if (FAILED(hr)) {
    return false;
}

Finally, in another function called Draw, I attach the data to the AI ​​and call DrawInstanced as follows. :

...
const UINT vertexStride = sizeof(VertexPosColor);
const UINT offset = 0;

const UINT instancedVetexStride = sizeof(XMMATRIX);

g_d3dDeviceContext->IASetVertexBuffers(0, 1, &g_d3dVertexBuffer, &vertexStride, &offset);
g_d3dDeviceContext->IASetVertexBuffers(1, 1, &g_d3dIndexedVertexBuffer, &instancedVetexStride, &offset);
g_d3dDeviceContext->IASetInputLayout(g_d3dInputLayout);
...

// Draw the cube
g_d3dDeviceContext->DrawIndexed(std::size(g_Indicies), 0, 0);
//g_d3dDeviceContext->DrawIndexedInstanced(std::size(g_Indicies), 1, 0, 0, 0);

The following is my vertex shader as is:

//VERTEX SHADER

cbuffer PerApplication : register(b0)
{
    matrix projectionMatrix;
}

cbuffer PerFrame : register(b1)
{
    matrix viewMatrix;
}

cbuffer PerObject : register(b2)
{
    matrix worldMatrix;
}

struct AppData
{
    float3 position : POSITION;
    float3 color: COLOR;
    matrix instancedMatrix : INSTANCED_MATS;
};

struct VertexShaderOutput
{
    float4 color : COLOR;
    float4 position : SV_POSITION;
};

VertexShaderOutput SimpleVertexShader(AppData IN, uint instanceID : SV_InstanceID)
{
    VertexShaderOutput OUT;
    uint p = instanceID;
    matrix mvp = mul(projectionMatrix, mul(viewMatrix, IN.instancedMatrix));// worldMatrix));
    float4 pos = float4(IN.position, 1.0f);
    OUT.position = mul(mvp, pos);
    OUT.color = float4(IN.color, 1.0f);

    return OUT;
}

I am not sure if I am adjusting the offsets incorrectly or if I am not correctly connecting the locations of the VBs to the AI. Or is it something to do with my entry description for BV.

But I get the following warning D3D11, which for me is vague because I don't know what offset of 80 it is.

D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: Input vertex slot 1 has stride 64 which is less than the minimum stride logically expected from the current Input Layout (80 bytes). This is OK, as hardware is perfectly capable of reading overlapping data. However the developer probably did not intend to make use of this behavior.  ( EXECUTION WARNING #355: DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL)
D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: Vertex Buffer at the input vertex slot 1 is not big enough for what the Draw*() call expects to traverse. This is OK, as reading off the end of the Buffer is defined to return 0. However the developer probably did not intend to make use of this behavior.  ( EXECUTION WARNING #356: DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL)

I've been stuck here for hours. Any help, advice is greatly appreciated !!

javascript – try to send query string parameters to another page using reactJS

I am trying to send query string parameters to another page using a historical object in the button click event as below

const viewChange = (record) => {
debugger;
history.push('/Viewchange?id=record.id&dataid=record.dataid');
};

and this is the route where I defined in the routes.js file

{
  path: '/Viewchange/:id/:dataid',
  exact: true,
  title: 'Viewchange',
  icon: 'dashboard',
  breadcrumbs: ('dashboard'),
  contentComponent: ViewChangeRequest,
  isEnabled: () => false,
},

some how i get a blank page with the url below

http://localhost:3000/Viewchange?id={} Record.id&dataid={} Record.dataid#

I dont know where i am wrong in this case, could someone let me know how to attach query string values ​​to url
the code below is the component i will redirect

 const ViewChangeRequest = (props) => {
  };
  export default withRouter(ViewChangeRequest);

Thanks in advance

customization – can we add an extra button on the woocommerce store page and use it to send product information, including image in a mail?

Battery exchange network

The Stack Exchange network includes 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers who want to learn, share knowledge and develop their careers.

Visit Stack Exchange

Other – I will send half the profit to your payment information | NewProxyLists

Hello.
I want to be a journalist on your adult site.
Whenever I receive a sale, I will send half the profit to your payment details.

You can contact me:
Telegram https://t.me/mickey1907
Skype mickey7091
E-mail [protected by e-mail]
yap [protected by e-mail]

I will publish your Android app on Google for $ 1

I will publish your Android app on Google

I will download your Android app from my Google PlayStore and Amazon App Store.
Don't waste your time and money on developer accounts, just buy this service for $ 1 and launch your app within hours.

.

encryption – How to securely send data to a javascript broswer client?

I have a client that requires some currently public API endpoints to be encrypted and secure (although it's more a check box than anything I'm afraid of as an attack, or I would not accept the task). I use https, I get and post requests from a JavaScript based phone application to a Rails backend. There is a simple connection made before the data download where an API key could be returned with the successful connection.

I'm wondering if the only necessary step here is to add an API key to these get and post API requests (that is, a client side stored by password) or it's there is a real benefit in digging into OpenSSL encryption and decryption, making a handshake with RSA to get an AES key etc … am I right to assume that https is already doing it in a proven method and that the hacking alone would at best waste my time, at worst introduce new vulnerabilities?

Would it be useful to encrypt a password before an https publication request, or is it already encrypted by the jquery publication request? Is there any point in encrypting API endpoints and manually decrypting them on the client side with something like webcrypto, or is this already behind the scenes in https?

c # – Primavera V10 – how to send a message in the notification tab from my extension, have a command?

I am creating an extension for my Spring v10 and need to send a message to the notification box.

I program in C # using Visual Studio

You are looking for a VPS server to send bulk emails via Amazon SES.

Hello. We are an e-mail marketing services company based in Asia. We have been serving for 7 years now. We use Simple Em from Amazon … | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1790226&goto=newpost

Can not send regular SMS instead of iMessage

I tried to everse it.
Restart the iPhone, remove the dialog box and send again, disable iMessage, reset the network settings. Nothing helps.
An other idea? My operator is Vodafone, and that is support sms.
impossible to send a message