auto v5 = v2 + (v3 - v2) * 0.5f;
auto v6 = v3 + (v1 - v3) * 0.5f;
uint16_t j = vertices.size();
- vertices.emplace_back(Vertex{
- {v4},
- });
- vertices.emplace_back(Vertex{
- {v5},
- });
- vertices.emplace_back(Vertex{
- {v6},
- });
+ vertices.emplace_back(Vertex{v4, Vector2::ZERO});
+ vertices.emplace_back(Vertex{v5, Vector2::ZERO});
+ vertices.emplace_back(Vertex{v6, Vector2::ZERO});
// Now, original tri breaks into 4, so replace this tri, and add 3 more
uint16_t i1 = indices[i * 3 + 1];
uint16_t i2 = indices[i * 3 + 2];
// add vertices
std::vector<Vertex> vertices;
- vertices.emplace_back(Vertex{Vector3{0, b, -a}});
- vertices.emplace_back(Vertex{Vector3{b, a, 0}});
- vertices.emplace_back(Vertex{Vector3{-b, a, -a}});
+ vertices.emplace_back(Vertex{Vector3{0, b, -a}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{b, a, 0}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{-b, a, -a}, Vector2::ZERO});
- vertices.emplace_back(Vertex{Vector3{0, b, a}});
- vertices.emplace_back(Vertex{Vector3{0, -b, a}});
- vertices.emplace_back(Vertex{Vector3{-a, 0, b}});
+ vertices.emplace_back(Vertex{Vector3{0, b, a}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{0, -b, a}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{-a, 0, b}, Vector2::ZERO});
- vertices.emplace_back(Vertex{Vector3{0, -b, -a}});
- vertices.emplace_back(Vertex{Vector3{a, 0, -b}});
- vertices.emplace_back(Vertex{Vector3{a, 0, b}});
+ vertices.emplace_back(Vertex{Vector3{0, -b, -a}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{a, 0, -b}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{a, 0, b}, Vector2::ZERO});
- vertices.emplace_back(Vertex{Vector3{-a, 0, -b}});
- vertices.emplace_back(Vertex{Vector3{b, -a, 0}});
- vertices.emplace_back(Vertex{Vector3{-b, -a, 0}});
+ vertices.emplace_back(Vertex{Vector3{-a, 0, -b}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{b, -a, 0}, Vector2::ZERO});
+ vertices.emplace_back(Vertex{Vector3{-b, -a, 0}, Vector2::ZERO});
for(auto& vertex : vertices)
{
struct BoundaryConstraint
{
- BoundaryConstraint(std::string name, Vector2 size, bool centered)
- : name(name),
+ BoundaryConstraint(std::string nameParam, Vector2 size, bool centeredParam)
+ : name(nameParam),
boundarySize(size),
- centered(centered)
+ centered(centeredParam)
{
}
void operator()(Vector3& current, const PropertyInputContainer& inputs)
Dali::ParentOrigin::CENTER,
};
- Layer viewLayer = Layer::New();
+ viewLayer = Layer::New();
window.Add(viewLayer);
viewLayer.SetProperty(Actor::Property::POSITION, Vector3(position));
return renderTask;
}
- void ConstrainSceneViewportCamera(RenderTask sceneRenderTask, Vector2 viewportOrigin)
+ void ConstrainSceneViewportCamera(RenderTask renderTask, Vector2 viewportOrigin)
{
Constraint constraint = Constraint::New<Vector3>(cameraActor, Actor::Property::POSITION, CameraPosConstraint());
constraint.AddSource(Source(cameraFrame, Actor::Property::POSITION));
constraint.AddSource(Source(cameraFrame, Actor::Property::SIZE));
constraint.Apply();
- constraint = Constraint::New<Vector2>(sceneRenderTask, RenderTask::Property::VIEWPORT_POSITION, ViewportPositionConstraint(viewportOrigin));
+ constraint = Constraint::New<Vector2>(renderTask, RenderTask::Property::VIEWPORT_POSITION, ViewportPositionConstraint(viewportOrigin));
constraint.AddSource(Source(viewportFrame, Actor::Property::POSITION));
constraint.Apply();
- constraint = Constraint::New<Vector2>(sceneRenderTask, RenderTask::Property::VIEWPORT_SIZE, ViewportSizeConstraint());
+ constraint = Constraint::New<Vector2>(renderTask, RenderTask::Property::VIEWPORT_SIZE, ViewportSizeConstraint());
constraint.AddSource(Source(viewportFrame, Actor::Property::SIZE));
constraint.Apply();
}
overlayCameraActor.SetPerspectiveProjection(windowSize);
window.Add(overlayCameraActor);
- RenderTask overlayRenderTask = window.GetRenderTaskList().CreateTask();
+ RenderTask renderTask = window.GetRenderTaskList().CreateTask();
- overlayRenderTask.SetCameraActor(overlayCameraActor);
- overlayRenderTask.SetInputEnabled(true);
- overlayRenderTask.SetClearEnabled(false);
- overlayRenderTask.SetSourceActor(source);
- overlayRenderTask.SetExclusive(true);
+ renderTask.SetCameraActor(overlayCameraActor);
+ renderTask.SetInputEnabled(true);
+ renderTask.SetClearEnabled(false);
+ renderTask.SetSourceActor(source);
+ renderTask.SetExclusive(true);
- overlayRenderTask.SetViewportPosition(Vector2(0, 0));
- overlayRenderTask.SetViewportSize(windowSize);
+ renderTask.SetViewportPosition(Vector2(0, 0));
+ renderTask.SetViewportSize(windowSize);
- overlayRenderTask.SetCullMode(false);
+ renderTask.SetCullMode(false);
- return overlayRenderTask;
+ return renderTask;
}
Actor CreateFrame(Vector2 position, Vector2 size, std::string label)
if(actorIdIndex != Property::INVALID_INDEX)
{
int actorIndex = slider["actorId"];
- float value = slider["value"];
- imageViews[actorIndex].SetProperty(Actor::Property::ORIENTATION, AngleAxis(Degree(value), Vector3::ZAXIS));
+ float newValue = slider["value"];
+ imageViews[actorIndex].SetProperty(Actor::Property::ORIENTATION, AngleAxis(Degree(newValue), Vector3::ZAXIS));
}
return true;
}
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
namespace
{
-
[[maybe_unused]] std::vector<std::string> split(const std::string& s, char seperator)
{
std::vector<std::string> output;
- std::string::size_type prev_pos = 0, pos = 0;
+ std::string::size_type prev_pos = 0, pos = 0;
while((pos = s.find(seperator, pos)) != std::string::npos)
{
- std::string substring( s.substr(prev_pos, pos-prev_pos) );
+ std::string substring(s.substr(prev_pos, pos - prev_pos));
output.push_back(substring);
prev_pos = ++pos;
}
- output.push_back(s.substr(prev_pos, pos-prev_pos)); // Last word
+ output.push_back(s.substr(prev_pos, pos - prev_pos)); // Last word
return output;
}
const uint32_t MAX_CUBES = GetEnvInt("MAX_CUBES", 200);
-#define GL(x) {glGetError();{x;};auto err = glGetError();if(err){ \
-printf("%p:%d: ERROR: 0x%X\n", this, __LINE__, int(err));} }
+#define GL(x) \
+ { \
+ glGetError(); \
+ { \
+ x; \
+ }; \
+ auto err = glGetError(); \
+ if(err) \
+ { \
+ printf("%p:%d: ERROR: 0x%X\n", this, __LINE__, int(err)); \
+ } \
+ }
constexpr GLfloat CUBE_VERTICES[] = {-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f};
constexpr float QUAD_VERTS[] = {
// positions // colors // texture coords
- 1.0f, 1.0f,
- 1.0f, -1.0f,
- -1.0f, -1.0f,
- -1.0f, 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ -1.0f,
+ -1.0f,
+ -1.0f,
+ -1.0f,
+ 1.0f,
};
constexpr unsigned short QUAD_INDICES[] = {
- 0, 1, 2,
- 3, 0, 2
-};
+ 0, 1, 2, 3, 0, 2};
constexpr float QUAD_UV[] = {
// positions // colors // texture coords
- 1.0f, 1.0f, // top right
- 1.0f, 0.0f, // bottom right
- 0.0f, 0.0f, // bottom left
- 0.0f, 1.0f // top left
+ 1.0f,
+ 1.0f, // top right
+ 1.0f,
+ 0.0f, // bottom right
+ 0.0f,
+ 0.0f, // bottom left
+ 0.0f,
+ 1.0f // top left
};
float matrixDegreesToRadians(float degrees)
operand1[8 + j] * operand2[4 * i + 2] + operand1[12 + j] * operand2[4 * i + 3];
}
}
- for(int i = 0; i < 16; i++)
+ for(i = 0; i < 16; i++)
{
destination[i] = theResult[i];
}
NativeRenderer::~NativeRenderer() = default;
-NativeRenderer::NativeRenderer(const CreateInfo& info )
+NativeRenderer::NativeRenderer(const CreateInfo& info)
: mWidth(info.width),
mHeight(info.height),
mCreateInfo(info)
[[maybe_unused]] auto y = mCreateInfo.viewportY; // float(mHeight - input.size.height) * 0.5f;
auto w = mCreateInfo.width;
auto h = mCreateInfo.height;
-
+
matrixPerspective(mProjectionMatrix, 45, (float)w / (float)h, 0.1f, 100);
GL(glViewport(x, y, w, h));
GL(glClearColor(mCreateInfo.clearColor[0],
mCreateInfo.clearColor[1],
mCreateInfo.clearColor[2],
- mCreateInfo.clearColor[3]
- ));
+ mCreateInfo.clearColor[3]));
{
GL(glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT));
}
const auto maxCubes = int(MAX_CUBES);
- for( int i = 0; i < int(maxCubes); ++i)
+ for(int i = 0; i < int(maxCubes); ++i)
{
GL(matrixIdentityFunction(mModelViewMatrix));
matrixScale(mModelViewMatrix, 0.2f, 0.2f, 0.2f);
auto max = 7000;
if(mPosX.size() == uint32_t(i))
{
- auto x = float((rand() % max) - (max / 2)) / 1000.0f;
- auto y = float((rand() % max) - (max / 2)) / 1000.0f;
- mPosX.emplace_back(x);
- mPosY.emplace_back(y);
+ auto xPos = float((rand() % max) - (max / 2)) / 1000.0f;
+ auto yPos = float((rand() % max) - (max / 2)) / 1000.0f;
+ mPosX.emplace_back(xPos);
+ mPosY.emplace_back(yPos);
}
matrixTranslate(mModelViewMatrix, mPosX[i], mPosY[i], -5.0f);
GL(glUniformMatrix4fv(mProjectionLocation, 1, GL_FALSE, mProjectionMatrix));
*/
namespace
{
-
constexpr GLfloat CUBE_VERTICES[] = {-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f};
constexpr GLfloat CUBE_COLOURS[] = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f};
operand1[8 + j] * operand2[4 * i + 2] + operand1[12 + j] * operand2[4 * i + 3];
}
}
- for(int i = 0; i < 16; i++)
+ for(i = 0; i < 16; i++)
{
destination[i] = theResult[i];
}