Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8199893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:15:52+00:00 2026-06-07T06:15:52+00:00

struct PLANE {FLOAT X, Y, Z; D3DXVECTOR3 Normal; FLOAT U, V;}; class PlaneStruct {

  • 0
struct PLANE {FLOAT X, Y, Z; D3DXVECTOR3 Normal; FLOAT U, V;};

class PlaneStruct
{
public:PLANE PlaneVertices[4];
public:DWORD PlaneIndices;

void CreatePlane(float size)
{
    // create vertices to represent the corners of the cube
    PlaneVertices = 
    {
        {1.0f * size, 0.0f, 1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 0.0f, 0.0f},    // side 1
        {-1.0f * size, -0.0f, 1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 0.0f, 1.0f},
        {-1.0f * size, -0.0f, -1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 1.0f, 0.0f},
        {1.0f * size, -0.0f, -1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 1.0f, 1.0f},
    };

    // create the index buffer out of DWORDs
    DWORD PlaneIndices[] =
    {
        0, 2, 1,    // side 1
        0, 3, 2
    };
}
};  

This was my code for a “plane” structure, i just have one question, if you look at the top it says PLANE PlaneVertices[4]; and then in a function i wanted to define it, so to give it specific values, but i get the following error:
Expression must be a modifiable value.
Please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:15:53+00:00Added an answer on June 7, 2026 at 6:15 am

    You cannot assign values to your PlaneVertices array like this, you can only use this when you define it using the {} notation to initialise it. Try assigning each element to each invidivual element of your array using a for loop

    Edit: In response to your comment, create an instance of your PLANE struct and assign the values to it that you want it to have. Then assign this to the first index in the PlaneVertices array using

        PlaneVertices[0] = // instance of PLANE struct you have just created
    

    then repeat for the remaining 3 instances of PLANE that you want in the array, adding to the 1,2,and 3 indices of PlaneVertices. To fully illustrate I will do the first one for you using your data provided

        PLANE plane_object;
        plane_object.X = 1.0*size;
        plane_object.Y = 0.0; 
        plane_object.Z = 1.0*size; 
        plane_object.Normal = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
        plane_object.U = 0.0;
        plane_object.V = 0.0;
        PlaneVertices[0] = plane_object;
    

    You then need to repeat for each PLANE you want to add. Also take not of the other answer concerning your PlaneIndices problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

struct Div { int i; int j; }; class A { public: A(); Div&
I am looking to create a fixed size struct header for variable sized array
public class MyClass { int i = 0; string str = here; MyStruct mystruct;
typedef struct { NSString *activty; NSString *place; float latitude; float longitude; } event; typedef
So, I tried doing something like this : void place(struct node * list, int
In the following code block, I create a pointer to a struct so I
I have struct: /VBAL/ /VBAL/Interface/ /VBAL/Interface/Named.php .... /VBAL/Component.php Component.php: namespace JV\VBAL; class Component implements
I am developing a CUDA ray-plane intersection kernel. Let's suppose, my plane (face) struct
NSPoint is a C-struct used in Cocoa to represent a point in the plane.
This is from my code: struct R3 { float x; float y; float z;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.