mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Remove software and opengl flow implementations
This simplifies the code base A LOT.
This commit is contained in:
182
common/rhi/flow_types.cpp
Normal file
182
common/rhi/flow_types.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
#include "flow_types.h"
|
||||
|
||||
/*** Preset Configurations ***/
|
||||
|
||||
struct Preset defaultYACReaderFlowConfig = {
|
||||
0.08f, // Animation_step sets the speed of the animation
|
||||
1.5f, // Animation_speedup sets the acceleration of the animation
|
||||
0.1f, // Animation_step_max sets the maximum speed of the animation
|
||||
3.f, // Animation_Fade_out_dis sets the distance of view
|
||||
|
||||
1.5f, // pre_rotation sets the rotation increasion
|
||||
3.f, // View_rotate_light_strenght sets the light strenght on rotation
|
||||
0.01f, // View_rotate_add sets the speed of the rotation
|
||||
0.02f, // View_rotate_sub sets the speed of reversing the rotation
|
||||
20.f, // View_angle sets the maximum view angle
|
||||
|
||||
0.f, // CF_X the X Position of the Coverflow
|
||||
0.f, // CF_Y the Y Position of the Coverflow
|
||||
-8.f, // CF_Z the Z Position of the Coverflow
|
||||
|
||||
15.f, // CF_RX the X Rotation of the Coverflow
|
||||
0.f, // CF_RY the Y Rotation of the Coverflow
|
||||
0.f, // CF_RZ the Z Rotation of the Coverflow
|
||||
|
||||
-50.f, // Rotation sets the rotation of each cover
|
||||
0.18f, // X_Distance sets the distance between the covers
|
||||
1.f, // Center_Distance sets the distance between the centered and the non centered covers
|
||||
0.1f, // Z_Distance sets the pushback amount
|
||||
0.0f, // Y_Distance sets the elevation amount
|
||||
|
||||
30.f // zoom level
|
||||
|
||||
};
|
||||
|
||||
struct Preset presetYACReaderFlowClassicConfig = {
|
||||
0.08f, // Animation_step sets the speed of the animation
|
||||
1.5f, // Animation_speedup sets the acceleration of the animation
|
||||
0.1f, // Animation_step_max sets the maximum speed of the animation
|
||||
2.f, // Animation_Fade_out_dis sets the distance of view
|
||||
|
||||
1.5f, // pre_rotation sets the rotation increasion
|
||||
3.f, // View_rotate_light_strenght sets the light strenght on rotation
|
||||
0.08f, // View_rotate_add sets the speed of the rotation
|
||||
0.08f, // View_rotate_sub sets the speed of reversing the rotation
|
||||
30.f, // View_angle sets the maximum view angle
|
||||
|
||||
0.f, // CF_X the X Position of the Coverflow
|
||||
-0.2f, // CF_Y the Y Position of the Coverflow
|
||||
-7.f, // CF_Z the Z Position of the Coverflow
|
||||
|
||||
0.f, // CF_RX the X Rotation of the Coverflow
|
||||
0.f, // CF_RY the Y Rotation of the Coverflow
|
||||
0.f, // CF_RZ the Z Rotation of the Coverflow
|
||||
|
||||
-40.f, // Rotation sets the rotation of each cover
|
||||
0.18f, // X_Distance sets the distance between the covers
|
||||
1.f, // Center_Distance sets the distance between the centered and the non centered covers
|
||||
0.1f, // Z_Distance sets the pushback amount
|
||||
0.0f, // Y_Distance sets the elevation amount
|
||||
|
||||
22.f // zoom level
|
||||
|
||||
};
|
||||
|
||||
struct Preset presetYACReaderFlowStripeConfig = {
|
||||
0.08f, // Animation_step sets the speed of the animation
|
||||
1.5f, // Animation_speedup sets the acceleration of the animation
|
||||
0.1f, // Animation_step_max sets the maximum speed of the animation
|
||||
6.f, // Animation_Fade_out_dis sets the distance of view
|
||||
|
||||
1.5f, // pre_rotation sets the rotation increasion
|
||||
4.f, // View_rotate_light_strenght sets the light strenght on rotation
|
||||
0.08f, // View_rotate_add sets the speed of the rotation
|
||||
0.08f, // View_rotate_sub sets the speed of reversing the rotation
|
||||
30.f, // View_angle sets the maximum view angle
|
||||
|
||||
0.f, // CF_X the X Position of the Coverflow
|
||||
-0.2f, // CF_Y the Y Position of the Coverflow
|
||||
-7.f, // CF_Z the Z Position of the Coverflow
|
||||
|
||||
0.f, // CF_RX the X Rotation of the Coverflow
|
||||
0.f, // CF_RY the Y Rotation of the Coverflow
|
||||
0.f, // CF_RZ the Z Rotation of the Coverflow
|
||||
|
||||
0.f, // Rotation sets the rotation of each cover
|
||||
1.1f, // X_Distance sets the distance between the covers
|
||||
0.2f, // Center_Distance sets the distance between the centered and the non centered covers
|
||||
0.01f, // Z_Distance sets the pushback amount
|
||||
0.0f, // Y_Distance sets the elevation amount
|
||||
|
||||
22.f // zoom level
|
||||
|
||||
};
|
||||
|
||||
struct Preset presetYACReaderFlowOverlappedStripeConfig = {
|
||||
0.08f, // Animation_step sets the speed of the animation
|
||||
1.5f, // Animation_speedup sets the acceleration of the animation
|
||||
0.1f, // Animation_step_max sets the maximum speed of the animation
|
||||
2.f, // Animation_Fade_out_dis sets the distance of view
|
||||
|
||||
1.5f, // pre_rotation sets the rotation increasion
|
||||
3.f, // View_rotate_light_strenght sets the light strenght on rotation
|
||||
0.08f, // View_rotate_add sets the speed of the rotation
|
||||
0.08f, // View_rotate_sub sets the speed of reversing the rotation
|
||||
30.f, // View_angle sets the maximum view angle
|
||||
|
||||
0.f, // CF_X the X Position of the Coverflow
|
||||
-0.2f, // CF_Y the Y Position of the Coverflow
|
||||
-7.f, // CF_Z the Z Position of the Coverflow
|
||||
|
||||
0.f, // CF_RX the X Rotation of the Coverflow
|
||||
0.f, // CF_RY the Y Rotation of the Coverflow
|
||||
0.f, // CF_RZ the Z Rotation of the Coverflow
|
||||
|
||||
0.f, // Rotation sets the rotation of each cover
|
||||
0.18f, // X_Distance sets the distance between the covers
|
||||
1.f, // Center_Distance sets the distance between the centered and the non centered covers
|
||||
0.1f, // Z_Distance sets the pushback amount
|
||||
0.0f, // Y_Distance sets the elevation amount
|
||||
|
||||
22.f // zoom level
|
||||
|
||||
};
|
||||
|
||||
struct Preset pressetYACReaderFlowUpConfig = {
|
||||
0.08f, // Animation_step sets the speed of the animation
|
||||
1.5f, // Animation_speedup sets the acceleration of the animation
|
||||
0.1f, // Animation_step_max sets the maximum speed of the animation
|
||||
2.5f, // Animation_Fade_out_dis sets the distance of view
|
||||
|
||||
1.5f, // pre_rotation sets the rotation increasion
|
||||
3.f, // View_rotate_light_strenght sets the light strenght on rotation
|
||||
0.08f, // View_rotate_add sets the speed of the rotation
|
||||
0.08f, // View_rotate_sub sets the speed of reversing the rotation
|
||||
5.f, // View_angle sets the maximum view angle
|
||||
|
||||
0.f, // CF_X the X Position of the Coverflow
|
||||
-0.2f, // CF_Y the Y Position of the Coverflow
|
||||
-7.f, // CF_Z the Z Position of the Coverflow
|
||||
|
||||
0.f, // CF_RX the X Rotation of the Coverflow
|
||||
0.f, // CF_RY the Y Rotation of the Coverflow
|
||||
0.f, // CF_RZ the Z Rotation of the Coverflow
|
||||
|
||||
-50.f, // Rotation sets the rotation of each cover
|
||||
0.18f, // X_Distance sets the distance between the covers
|
||||
1.f, // Center_Distance sets the distance between the centered and the non centered covers
|
||||
0.1f, // Z_Distance sets the pushback amount
|
||||
-0.1f, // Y_Distance sets the elevation amount
|
||||
|
||||
22.f // zoom level
|
||||
|
||||
};
|
||||
|
||||
struct Preset pressetYACReaderFlowDownConfig = {
|
||||
0.08f, // Animation_step sets the speed of the animation
|
||||
1.5f, // Animation_speedup sets the acceleration of the animation
|
||||
0.1f, // Animation_step_max sets the maximum speed of the animation
|
||||
2.5f, // Animation_Fade_out_dis sets the distance of view
|
||||
|
||||
1.5f, // pre_rotation sets the rotation increasion
|
||||
3.f, // View_rotate_light_strenght sets the light strenght on rotation
|
||||
0.08f, // View_rotate_add sets the speed of the rotation
|
||||
0.08f, // View_rotate_sub sets the speed of reversing the rotation
|
||||
5.f, // View_angle sets the maximum view angle
|
||||
|
||||
0.f, // CF_X the X Position of the Coverflow
|
||||
-0.2f, // CF_Y the Y Position of the Coverflow
|
||||
-7.f, // CF_Z the Z Position of the Coverflow
|
||||
|
||||
0.f, // CF_RX the X Rotation of the Coverflow
|
||||
0.f, // CF_RY the Y Rotation of the Coverflow
|
||||
0.f, // CF_RZ the Z Rotation of the Coverflow
|
||||
|
||||
-50.f, // Rotation sets the rotation of each cover
|
||||
0.18f, // X_Distance sets the distance between the covers
|
||||
1.f, // Center_Distance sets the distance between the centered and the non centered covers
|
||||
0.1f, // Z_Distance sets the pushback amount
|
||||
0.1f, // Y_Distance sets the elevation amount
|
||||
|
||||
22.f // zoom level
|
||||
};
|
||||
75
common/rhi/flow_types.h
Normal file
75
common/rhi/flow_types.h
Normal file
@ -0,0 +1,75 @@
|
||||
// Shared types for YACReader Flow implementations (GL and RHI)
|
||||
#ifndef __YACREADER_FLOW_TYPES_H
|
||||
#define __YACREADER_FLOW_TYPES_H
|
||||
|
||||
enum Performance {
|
||||
low = 0,
|
||||
medium,
|
||||
high,
|
||||
ultraHigh
|
||||
};
|
||||
|
||||
// Cover Vector
|
||||
struct YACReader3DVector {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float rot;
|
||||
};
|
||||
|
||||
struct Preset {
|
||||
/*** Animation Settings ***/
|
||||
// sets the speed of the animation
|
||||
float animationStep;
|
||||
// sets the acceleration of the animation
|
||||
float animationSpeedUp;
|
||||
// sets the maximum speed of the animation
|
||||
float animationStepMax;
|
||||
// sets the distance of view
|
||||
float animationFadeOutDist;
|
||||
// sets the rotation increasion
|
||||
float preRotation;
|
||||
// sets the light strenght on rotation
|
||||
float viewRotateLightStrenght;
|
||||
// sets the speed of the rotation
|
||||
float viewRotateAdd;
|
||||
// sets the speed of reversing the rotation
|
||||
float viewRotateSub;
|
||||
// sets the maximum view angle
|
||||
float viewAngle;
|
||||
|
||||
/*** Position Configuration ***/
|
||||
// the X Position of the Coverflow
|
||||
float cfX;
|
||||
// the Y Position of the Coverflow
|
||||
float cfY;
|
||||
// the Z Position of the Coverflow
|
||||
float cfZ;
|
||||
// the X Rotation of the Coverflow
|
||||
float cfRX;
|
||||
// the Y Rotation of the Coverflow
|
||||
float cfRY;
|
||||
// the Z Rotation of the Coverflow
|
||||
float cfRZ;
|
||||
// sets the rotation of each cover
|
||||
float rotation;
|
||||
// sets the distance between the covers
|
||||
float xDistance;
|
||||
// sets the distance between the centered and the non centered covers
|
||||
float centerDistance;
|
||||
// sets the pushback amount
|
||||
float zDistance;
|
||||
// sets the elevation amount
|
||||
float yDistance;
|
||||
|
||||
float zoom;
|
||||
};
|
||||
|
||||
extern struct Preset defaultYACReaderFlowConfig;
|
||||
extern struct Preset presetYACReaderFlowClassicConfig;
|
||||
extern struct Preset presetYACReaderFlowStripeConfig;
|
||||
extern struct Preset presetYACReaderFlowOverlappedStripeConfig;
|
||||
extern struct Preset pressetYACReaderFlowUpConfig;
|
||||
extern struct Preset pressetYACReaderFlowDownConfig;
|
||||
|
||||
#endif // __YACREADER_FLOW_TYPES_H
|
||||
@ -121,7 +121,7 @@ void YACReaderComicFlow3D::resortCovers(QList<int> newOrder)
|
||||
|
||||
QList<QString> pathsNew;
|
||||
QVector<bool> loadedNew;
|
||||
QVector<YACReaderComicReadStatus> marksNew;
|
||||
QVector<YACReader::YACReaderComicReadStatus> marksNew;
|
||||
QVector<YACReader3DImageRHI> imagesNew;
|
||||
|
||||
int index = 0;
|
||||
|
||||
@ -169,7 +169,6 @@ void YACReaderFlow3D::initialize(QRhiCommandBuffer *cb)
|
||||
// Two triangles forming a quad (triangle list):
|
||||
// Tri 1: bottom-left, bottom-right, top-right
|
||||
// Tri 2: bottom-left, top-right, top-left
|
||||
// Texture coords flipped vertically to match OpenGL convention
|
||||
float vertices[] = {
|
||||
// Position (x, y, z), TexCoord (u, v)
|
||||
-0.5f, -0.5f, 0.0f, 0.0f, 1.0f, // Bottom-left
|
||||
@ -189,7 +188,7 @@ void YACReaderFlow3D::initialize(QRhiCommandBuffer *cb)
|
||||
scene.alignedUniformSize = m_rhi->ubufAligned(sizeof(UniformData));
|
||||
}
|
||||
|
||||
// Create sampler with trilinear filtering (like the OpenGL version)
|
||||
// Create sampler with trilinear filtering
|
||||
if (!scene.sampler) {
|
||||
scene.sampler.reset(m_rhi->newSampler(
|
||||
QRhiSampler::Linear, // mag filter
|
||||
@ -481,7 +480,6 @@ void YACReaderFlow3D::render(QRhiCommandBuffer *cb)
|
||||
};
|
||||
|
||||
// Collect all draws we need to make
|
||||
// Important: OpenGL draws reflections FIRST, then covers+marks (for correct depth sorting)
|
||||
QVector<DrawInfo> draws;
|
||||
|
||||
// Start timing for this render call (measures CPU time spent in this function)
|
||||
@ -532,8 +530,8 @@ void YACReaderFlow3D::render(QRhiCommandBuffer *cb)
|
||||
continue;
|
||||
|
||||
// Add mark draw immediately after its cover
|
||||
if (showMarks && loaded[idx] && marks[idx] != Unread) {
|
||||
QRhiTexture *markTex = (marks[idx] == Read) ? scene.markTexture.get() : scene.readingTexture.get();
|
||||
if (showMarks && loaded[idx] && marks[idx] != YACReader::Unread) {
|
||||
QRhiTexture *markTex = (marks[idx] == YACReader::Read) ? scene.markTexture.get() : scene.readingTexture.get();
|
||||
if (markTex) {
|
||||
if (!isVisibleInNDC(images[idx], false, true))
|
||||
continue;
|
||||
@ -1001,7 +999,7 @@ void YACReaderFlow3D::add(int item)
|
||||
|
||||
images.insert(item, YACReader3DImageRHI());
|
||||
loaded.insert(item, false);
|
||||
marks.insert(item, Unread);
|
||||
marks.insert(item, YACReader::Unread);
|
||||
numObjects++;
|
||||
|
||||
for (int i = item + 1; i < numObjects; i++) {
|
||||
|
||||
@ -12,25 +12,10 @@
|
||||
#include <QtGui>
|
||||
#include <rhi/qrhi.h>
|
||||
|
||||
#include "pictureflow.h"
|
||||
#include "flow_types.h"
|
||||
#include "yacreader_global.h"
|
||||
#include "scroll_management.h"
|
||||
|
||||
// Reuse enums and structs from OpenGL version
|
||||
enum Performance {
|
||||
low = 0,
|
||||
medium,
|
||||
high,
|
||||
ultraHigh
|
||||
};
|
||||
|
||||
// Cover Vector
|
||||
struct YACReader3DVector {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float rot;
|
||||
};
|
||||
|
||||
// the image/texture info struct
|
||||
struct YACReader3DImageRHI {
|
||||
QRhiTexture *texture;
|
||||
@ -47,41 +32,6 @@ struct YACReader3DImageRHI {
|
||||
YACReader3DVector animEnd;
|
||||
};
|
||||
|
||||
struct Preset {
|
||||
/*** Animation Settings ***/
|
||||
float animationStep;
|
||||
float animationSpeedUp;
|
||||
float animationStepMax;
|
||||
float animationFadeOutDist;
|
||||
float preRotation;
|
||||
float viewRotateLightStrenght;
|
||||
float viewRotateAdd;
|
||||
float viewRotateSub;
|
||||
float viewAngle;
|
||||
|
||||
/*** Position Configuration ***/
|
||||
float cfX;
|
||||
float cfY;
|
||||
float cfZ;
|
||||
float cfRX;
|
||||
float cfRY;
|
||||
float cfRZ;
|
||||
float rotation;
|
||||
float xDistance;
|
||||
float centerDistance;
|
||||
float zDistance;
|
||||
float yDistance;
|
||||
|
||||
float zoom;
|
||||
};
|
||||
|
||||
extern struct Preset defaultYACReaderFlowConfig;
|
||||
extern struct Preset presetYACReaderFlowClassicConfig;
|
||||
extern struct Preset presetYACReaderFlowStripeConfig;
|
||||
extern struct Preset presetYACReaderFlowOverlappedStripeConfig;
|
||||
extern struct Preset pressetYACReaderFlowUpConfig;
|
||||
extern struct Preset pressetYACReaderFlowDownConfig;
|
||||
|
||||
class QLabel;
|
||||
class ImageLoader3D;
|
||||
class ImageLoaderByteArray3D;
|
||||
@ -204,7 +154,7 @@ protected:
|
||||
int lazyPopulateObjects;
|
||||
bool showMarks;
|
||||
QVector<bool> loaded;
|
||||
QVector<YACReaderComicReadStatus> marks;
|
||||
QVector<YACReader::YACReaderComicReadStatus> marks;
|
||||
|
||||
QVector<YACReader3DImageRHI> images;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user