[ゲーム開発]点描画を使って扇形を描画させたい。

提示コードですが一様扇形が描画されているのですがこの形を上向きに表示させたいです。その位置でベクトルの向きに回転等の処理も追加して回転できるようにするにはどういった形でflota i 変数の初期値とif(i > 0)の式を変更したらいいのでしょうか?

知りたい事

ベクトルの向きに表示する処理を実装したい

イメージ説明

cpp

void SDL::Sector_Render::Render(){ glm::vec2 end = glm::vec2(0,0); float f = PI / 1000.0f; for(float i = -(PI / 2); i < (PI * 2.0f); i += f) { float cos = glm::cos(i) * range + transform.position.x; for(int j = 0; j < range; j++) { float sin = glm::sin(i) * j + transform.position.y; end.x = cos; end.y = sin; SDL_SetRenderDrawColor(render, color.x,color.y,color.z, color.w); SDL_RenderDrawPoint(render,end.x,end.y); SDL_SetRenderDrawColor(render, 0, 0, 0, 255); } if( i > 0 ) { std::cout<<"aaaa"<<std::endl; break; } } }

コメントを投稿

0 コメント