Add ktx
This commit is contained in:
1 parent
14bd1a9271
commit
13fa90a0e9
3958 files changed
+999286
-4
No files matched your search
@@ -0,0 +1,330 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2017-2020 Mark Callow.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @class LoadTestSample
|
||||
* @~English
|
||||
*
|
||||
* @brief Definition of a base class for texture loading test samples.
|
||||
*
|
||||
* @author Mark Callow, github.com/MarkCallow.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif
|
||||
#include "LoadTestSample.h"
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/vector_angle.hpp>
|
||||
#include <SDL3/SDL_log.h>
|
||||
|
||||
#if !defined(LOADTESTSAMPLE_LOG_GESTURE_DETECTION)
|
||||
// Log detected and completed gestures.
|
||||
#define LOADTESTSAMPLE_LOG_GESTURE_DETECTION 0
|
||||
#endif
|
||||
#if !defined(LOADTESTSAMPLE_LOG_GESTURE_EVENTS)
|
||||
// Log events contributing to gesture detection and gestures.
|
||||
#define LOADTESTSAMPLE_LOG_GESTURE_EVENTS 0
|
||||
#endif
|
||||
#if !defined(LOADTESTSAMPLE_LOG_MOUSE_UP_DOWN_EVENTS)
|
||||
#define LOADTESTSAMPLE_LOG_MOUSE_UP_DOWN_EVENTS 0
|
||||
#endif
|
||||
#if !defined(LOADTESTSAMPLE_LOG_MOUSE_MOTION_EVENTS)
|
||||
#define LOADTESTSAMPLE_LOG_MOUSE_MOTION_EVENTS 0
|
||||
#endif
|
||||
|
||||
#if LOADTESTSAMPLE_LOG_GESTURE_EVENTS
|
||||
#include <sstream>
|
||||
|
||||
const std::string printFingerIds(SDL_Finger* fingers[], uint32_t numFingers) {
|
||||
std::stringstream msg;
|
||||
assert(numFingers > 0);
|
||||
msg << std::hex << std::showbase;
|
||||
msg << "finger id" << (numFingers > 1 ? "s" : "") << ": ";
|
||||
for (uint32_t f = 0; f < numFingers; f++) {
|
||||
if (f > 0) {
|
||||
if (f == numFingers - 1)
|
||||
msg << " & ";
|
||||
else
|
||||
msg << ", ";
|
||||
}
|
||||
msg << fingers[f]->id;
|
||||
}
|
||||
return msg.str();
|
||||
}
|
||||
|
||||
const std::string printVector(const std::string& name, glm::vec2 v) {
|
||||
std::stringstream msg;
|
||||
msg << name << " (" << v.x << ", " << v.y << ")";
|
||||
return msg.str();
|
||||
}
|
||||
#endif
|
||||
|
||||
[[maybe_unused]] static const char*
|
||||
buttonName(Uint8 button) {
|
||||
switch(button) {
|
||||
case SDL_BUTTON_LEFT: return "left";
|
||||
case SDL_BUTTON_MIDDLE: return "middle";
|
||||
case SDL_BUTTON_RIGHT: return "right";
|
||||
default: return "other";
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
LoadTestSample::doEvent(SDL_Event* event)
|
||||
{
|
||||
switch (event->type) {
|
||||
case SDL_EVENT_MOUSE_MOTION:
|
||||
{
|
||||
SDL_MouseMotionEvent& motion = event->motion;
|
||||
#if LOADTESTSAMPLE_LOG_MOUSE_MOTION_EVENTS
|
||||
SDL_Log("LTS: MOUSE_MOTION - x: %f, y: %f", motion.x, motion.y);
|
||||
#endif
|
||||
// On macOS with trackpad, SDL_TOUCH_MOUSEID is never set.
|
||||
// Prefer mouse events on macOS because press is required. When
|
||||
// finger motion events are used the object starts to rotate when
|
||||
// you drag the cursor over the window. Not nice.
|
||||
if (mouseButtons.left)
|
||||
{
|
||||
rotation.x -= yflip * (mousePos.y - (float)motion.y) * 1.25f;
|
||||
rotation.y -= (mousePos.x - (float)motion.x) * 1.25f;
|
||||
viewChanged();
|
||||
}
|
||||
if (mouseButtons.right)
|
||||
{
|
||||
zoom += (mousePos.y - (float)motion.y) * .005f;
|
||||
viewChanged();
|
||||
}
|
||||
if (mouseButtons.middle)
|
||||
{
|
||||
cameraPos.x -= (mousePos.x - (float)motion.x) * 0.01f;
|
||||
cameraPos.y += yflip * (mousePos.y - (float)motion.y) * 0.01f;
|
||||
viewChanged();
|
||||
}
|
||||
mousePos = glm::vec2((float)motion.x, (float)motion.y);
|
||||
return 0;
|
||||
}
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
mousePos = glm::vec2((float)event->button.x, (float)event->button.y);
|
||||
if (LOADTESTSAMPLE_LOG_MOUSE_UP_DOWN_EVENTS) {
|
||||
SDL_Log("LTS: MOUSE_DOWN - button: %s, x: %f, y: %f", buttonName(event->button.button),
|
||||
event->button.x, event->button.y);
|
||||
}
|
||||
switch (event->button.button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
mouseButtons.left = true;
|
||||
break;
|
||||
case SDL_BUTTON_MIDDLE:
|
||||
mouseButtons.middle = true;
|
||||
break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
mouseButtons.right = true;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP:
|
||||
if (LOADTESTSAMPLE_LOG_MOUSE_UP_DOWN_EVENTS) {
|
||||
SDL_Log("LTS: MOUSE_UP - button: %s, x: %f, y: %f", buttonName(event->button.button),
|
||||
event->button.x, event->button.y);
|
||||
}
|
||||
switch (event->button.button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
mouseButtons.left = false;
|
||||
break;
|
||||
case SDL_BUTTON_MIDDLE:
|
||||
mouseButtons.middle = false;
|
||||
break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
mouseButtons.right = false;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
case SDL_EVENT_FINGER_DOWN: {
|
||||
// Prevent multifingers from triggering the left button action and
|
||||
// interfering with multigestures.
|
||||
//
|
||||
// On iOS you get a left button down event no matter how many fingers
|
||||
// you touch to the screen. We want 1 finger mouse to work so
|
||||
// behaviour is same as pressing the trackpad on macOS, etc. As iOS
|
||||
// button_down events come before finger_down we can clear the left
|
||||
// button down state, if we have multiple fingers. Hope this ordering
|
||||
// is the same on other touch screen platforms that send a left-button
|
||||
// event regardless of the number of fingers.
|
||||
//
|
||||
// On macOS button_down events come after finger_down so this code has
|
||||
// no effect.
|
||||
//
|
||||
// Another way to handle this is to identify the platform and work
|
||||
// differently for each platform.
|
||||
int numFingers;
|
||||
SDL_Finger** fingers = SDL_GetTouchFingers(event->tfinger.touchID, &numFingers);
|
||||
int retVal = 0;
|
||||
#if LOADTESTSAMPLE_LOG_GESTURE_EVENTS
|
||||
SDL_Log("LTS: Finger: %#" SDL_PRIx64 " down - fingers: %i, %s, x: %f, y: %f",
|
||||
event->tfinger.fingerID, numFingers,
|
||||
printFingerIds(fingers, numFingers).c_str(),
|
||||
event->tfinger.x, event->tfinger.y);
|
||||
#endif
|
||||
if (numFingers > 1) {
|
||||
mouseButtons.left = false;
|
||||
if (LOADTESTSAMPLE_LOG_GESTURE_EVENTS) {
|
||||
SDL_Log("LTS: FINGER_DOWN with multiple fingers received."
|
||||
" Resetting mouseButtons.left.");
|
||||
}
|
||||
if (numFingers == 2) {
|
||||
firstFingerId = fingers[0]->id;
|
||||
// Calc. difference vector between fingers.
|
||||
glm::vec2 vDifference;
|
||||
vDifference.x = fingers[1]->x - fingers[0]->x;
|
||||
vDifference.y = fingers[1]->y - fingers[0]->y;
|
||||
distanceStart = glm::length(vDifference);
|
||||
distanceLast = distanceStart;
|
||||
// Need normalized vectors for glm::orientedAngle
|
||||
nvDifferenceStart = glm::normalize(vDifference);
|
||||
nvDifferenceLast = nvDifferenceStart;
|
||||
processingGesture = true;
|
||||
#if LOADTESTSAMPLE_LOG_GESTURE_EVENTS
|
||||
// Angle of vector to X axis.
|
||||
xAngleStart = atan2f(vDifference.y, vDifference.x);
|
||||
SDL_Log("LTS: FINGER_DOWN, start values: %s, Distance = %f, XAngle = %f°",
|
||||
printVector("Difference", vDifference).c_str(),
|
||||
distanceStart, xAngleStart * 180.0 / M_PI
|
||||
);
|
||||
#endif
|
||||
retVal = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// It is possible to somehow get out of the window without seeing
|
||||
// FINGER_UP so as a safeguard stop any previous gesture.
|
||||
zooming = rotating = false;
|
||||
SDL_free(fingers);
|
||||
return retVal;
|
||||
}
|
||||
case SDL_EVENT_FINGER_UP: {
|
||||
int numFingers;
|
||||
SDL_Finger** fingers = SDL_GetTouchFingers(event->tfinger.touchID, &numFingers);
|
||||
#if LOADTESTSAMPLE_LOG_GESTURE_EVENTS
|
||||
SDL_Log("LTS: Finger: %#" SDL_PRIx64 " up - fingers: %i, %s, x: %f, y: %f",
|
||||
event->tfinger.fingerID, numFingers,
|
||||
printFingerIds(fingers, numFingers).c_str(),
|
||||
event->tfinger.x, event->tfinger.y);
|
||||
#endif
|
||||
if (processingGesture && numFingers == 2) {
|
||||
// There may still be one finger down. Even so the action is completed.
|
||||
if (LOADTESTSAMPLE_LOG_GESTURE_DETECTION) {
|
||||
SDL_Log("-------------- LTS: %s complete. -----------------",
|
||||
zooming ? "zooming" : rotating ? "rotating" : "gesture");
|
||||
}
|
||||
zooming = rotating = processingGesture = false;
|
||||
}
|
||||
SDL_free(fingers);
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_FINGER_MOTION: {
|
||||
int numFingers;
|
||||
SDL_Finger** fingers = SDL_GetTouchFingers(event->tfinger.touchID, &numFingers);
|
||||
if (numFingers != 2)
|
||||
return 1;
|
||||
if (!processingGesture) {
|
||||
// Protect against FINGER_MOTION without FINGER_DOWN. This can
|
||||
// happen when the sample is switched by a swipe and the new sample
|
||||
// receives the tail end of the swipe motion.
|
||||
return 1;
|
||||
}
|
||||
// With two fingers down, events come in pairs. No point in processing
|
||||
// both.
|
||||
if (event->tfinger.fingerID == firstFingerId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
glm::vec2 vDifference; // Difference vector between the fingers.
|
||||
vDifference.x = fingers[1]->x - fingers[0]->x;
|
||||
vDifference.y = fingers[1]->y - fingers[0]->y;
|
||||
float distance = glm::length(vDifference);
|
||||
// Normalized vectors required by glm::orientedAngle
|
||||
glm::vec2 nvDifference = glm::normalize(vDifference);
|
||||
// Angle between start and current difference vectors
|
||||
float sAngle = glm::orientedAngle(nvDifferenceStart, nvDifference);
|
||||
// Angle between current and previous difference vectors
|
||||
float dAngle = glm::orientedAngle(nvDifferenceLast, nvDifference);
|
||||
// Difference in distance since last motion event.
|
||||
float dDist = distance - distanceLast;
|
||||
// Difference in distance since start.
|
||||
float dDistStart = distance - distanceStart;
|
||||
#if LOADTESTSAMPLE_LOG_GESTURE_EVENTS
|
||||
if (!(rotating || zooming)) {
|
||||
// Angle from X axis to vDifference vector
|
||||
float xAngle = atan2f(vDifference.y, vDifference.x);
|
||||
SDL_Log("LTS FINGER_MOTION: Not zooming or rotating. "
|
||||
" timestamp = %" SDL_PRIu64 ", %s, %s",
|
||||
event->tfinger.timestamp,
|
||||
printFingerIds(fingers, numFingers).c_str(),
|
||||
printVector("Difference", vDifference).c_str());
|
||||
SDL_Log("... distanceLast = %f, distance = %f, dDist = %f, dDistStart = %f, xAngle = %f°, sAngle = %f°, dAngle = %f°",
|
||||
distanceLast, distance, dDist, dDistStart,
|
||||
xAngle * 180.0 / M_PI, sAngle * 180.0 / M_PI, dAngle * 180.0 / M_PI);
|
||||
}
|
||||
#endif
|
||||
nvDifferenceLast = nvDifference;
|
||||
distanceLast = distance;
|
||||
|
||||
// This is all heuristics derived from use.
|
||||
if (zooming) {
|
||||
zoom += dDist * 10.0f;
|
||||
if (LOADTESTSAMPLE_LOG_GESTURE_EVENTS) {
|
||||
SDL_Log("LTS MG: Zooming. zoom = %f", zoom);
|
||||
}
|
||||
} else if (!rotating) {
|
||||
if (fabs(dDistStart) >= 0.1 && fabs(dAngle) < 0.5 * M_PI / 180.0) {
|
||||
zooming = true;
|
||||
zoom += dDist * 10.0f;
|
||||
if (LOADTESTSAMPLE_LOG_GESTURE_DETECTION) {
|
||||
SDL_Log("---------------- LTS MG: pinch/zoom detected ---------------\n"
|
||||
" dAngle = %f°, dDistStart = %f, dDist = %f, zoom = %f",
|
||||
dAngle * 180.0 / M_PI, dDistStart, dDist, zoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rotating) {
|
||||
rotation.z +=
|
||||
static_cast<float>(dAngle * 180.0 / M_PI);
|
||||
if (LOADTESTSAMPLE_LOG_GESTURE_EVENTS) {
|
||||
SDL_Log("LTS MG: Rotating around Z. rotation.z = %f°", rotation.z);
|
||||
}
|
||||
} else if (!zooming) {
|
||||
if (fabs(sAngle) > 15 * M_PI / 180.0 && fabs(dDistStart) < 0.1) {
|
||||
rotating = true;
|
||||
rotation.z += static_cast<float>(dAngle * 180.0 / M_PI);
|
||||
if (LOADTESTSAMPLE_LOG_GESTURE_DETECTION) {
|
||||
SDL_Log("---------------- LTS MG: rotation detected ---------------\n"
|
||||
" sAngle = %f°, dAngle = %f°, dDistStart = %f, rotation.z = %f°",
|
||||
sAngle * 180 / M_PI, dAngle * 180.0 / M_PI, dDistStart, rotation.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
viewChanged();
|
||||
SDL_free(fingers);
|
||||
return 0;
|
||||
}
|
||||
case SDL_EVENT_KEY_UP:
|
||||
if (event->key.key == 'q')
|
||||
quit = true;
|
||||
keyPressed(event->key.key);
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2017-2020 Mark Callow, <khronos at callow dot im>.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _LOAD_TEST_SAMPLE_H
|
||||
#define _LOAD_TEST_SAMPLE_H
|
||||
|
||||
#include <string>
|
||||
#include <SDL3/SDL.h>
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include "disable_glm_warnings.h"
|
||||
#include <glm/glm.hpp>
|
||||
#include "reenable_warnings.h"
|
||||
|
||||
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
class LoadTestSample {
|
||||
public:
|
||||
typedef uint64_t ticks_t;
|
||||
LoadTestSample(uint32_t width, uint32_t height,
|
||||
const std::string sBasePath,
|
||||
int32_t yflip = 1)
|
||||
: w_width(width), w_height(height), yflip(yflip),
|
||||
sBasePath(sBasePath)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~LoadTestSample() { };
|
||||
virtual int doEvent(SDL_Event* event);
|
||||
virtual void resize(uint32_t width, uint32_t height) = 0;
|
||||
virtual void run(uint32_t msTicks) = 0;
|
||||
|
||||
//virtual void getOverlayText(TextOverlay *textOverlay) { };
|
||||
|
||||
typedef LoadTestSample* (*PFN_create)(uint32_t width, uint32_t height,
|
||||
const char* const szArgs,
|
||||
const std::string sBasePath);
|
||||
|
||||
protected:
|
||||
virtual void keyPressed(uint32_t /*keyCode*/) { }
|
||||
virtual void viewChanged() { }
|
||||
|
||||
const std::string getAssetPath() { return sBasePath; }
|
||||
|
||||
glm::vec3 rotation;
|
||||
glm::vec3 cameraPos;
|
||||
glm::vec2 mousePos;
|
||||
glm::vec2 nvDifferenceStart; // Normalized difference between fingers at start of gesture.
|
||||
float distanceStart = 0.0; // Distance between fingers at start of gesture.
|
||||
float xAngleStart = 0.0; // Angle between x-axis and nvDifferenceStart. Unused unless event logging is enabled.
|
||||
glm::vec2 nvDifferenceLast; // Normalized difference between fingers at last motion event.
|
||||
float distanceLast = 0.0; // Distance between fingers at last motion event.
|
||||
Uint64 firstFingerId = 0;
|
||||
bool processingGesture = false;
|
||||
|
||||
struct {
|
||||
bool left = false;
|
||||
bool right = false;
|
||||
bool middle = false;
|
||||
} mouseButtons;
|
||||
bool quit = false;
|
||||
bool rotating = false;
|
||||
bool zooming = false;
|
||||
bool paused = false;
|
||||
|
||||
float zoom = 0;
|
||||
|
||||
uint32_t w_width;
|
||||
uint32_t w_height;
|
||||
|
||||
// Defines a frame rate independent timer value clamped from -1.0...1.0
|
||||
// For use in animations, rotations, etc.
|
||||
float timer = 0.0f;
|
||||
// Multiplier for speeding up (or slowing down) the global timer
|
||||
float timerSpeed = 0.25f;
|
||||
|
||||
// Use to adjust mouse rotation speed
|
||||
float rotationSpeed = 1.0f;
|
||||
// Use to adjust mouse zoom speed
|
||||
float zoomSpeed = 1.0f;
|
||||
// multiplier to decide if Y increases down or up
|
||||
int32_t yflip;
|
||||
|
||||
const std::string sBasePath;
|
||||
};
|
||||
|
||||
#endif /* _LOAD_TEST_SAMPLE_H */
|
||||
@@ -0,0 +1,146 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2017-2020 Mark Callow.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @class SwipeDetector
|
||||
* @~English
|
||||
*
|
||||
* @brief Definition of a class for detecting swipes.
|
||||
*
|
||||
* @author Mark Callow, github.com/MarkCallow.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "SwipeDetector.h"
|
||||
#include <SDL3/SDL_log.h>
|
||||
|
||||
#if !defined(SWIPEDETECTOR_LOG_GESTURE_EVENTS)
|
||||
#define SWIPEDETECTOR_LOG_GESTURE_EVENTS 0
|
||||
#endif
|
||||
#if !defined(SWIPEDETECTOR_LOG_GESTURE_DETECTION)
|
||||
#define SWIPEDETECTOR_LOG_GESTURE_DETECTION 0
|
||||
#endif
|
||||
|
||||
bool
|
||||
SwipeDetector::doEvent(SDL_Event* event)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
switch (event->type) {
|
||||
case SDL_EVENT_FINGER_UP: {
|
||||
int numFingers;
|
||||
SDL_Finger** fingers = SDL_GetTouchFingers(event->tfinger.touchID, &numFingers);
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_EVENTS) {
|
||||
SDL_Log("SD: Finger: %" SDL_PRIx64 " UP - fingers: %i, x: %f, y: %f",
|
||||
event->tfinger.fingerID, numFingers, event->tfinger.x, event->tfinger.y);
|
||||
}
|
||||
// SDL_GetTouchFingers appears to return the number of fingers
|
||||
// down *before* the event was generated, so 1 means the last finger
|
||||
// just lifted.
|
||||
if (numFingers == 1 && gestureStart.time != 0) {
|
||||
gestureStart.time = 0;
|
||||
gestureSwipe = false;
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_DETECTION) {
|
||||
SDL_Log("***************** SD: FINGER_UP, %smultigesture done *****************",
|
||||
gestureSwipe ? "Swipe complete & " : "");
|
||||
}
|
||||
} else {
|
||||
result = true;
|
||||
}
|
||||
SDL_free(fingers);
|
||||
break;
|
||||
}
|
||||
case GESTURE_MULTIGESTURE: {
|
||||
Gesture_MultiGestureEvent& mgesture = *(Gesture_MultiGestureEvent *)event;
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_EVENTS) {
|
||||
SDL_Log("SD: MG Event: x = %f, y = %f, dAng = %f (%f), dR = %f, numFingers = %i, time = %" SDL_PRIu64,
|
||||
mgesture.x,
|
||||
mgesture.y,
|
||||
mgesture.dTheta * 180.0 / M_PI,
|
||||
mgesture.dTheta,
|
||||
mgesture.dDist,
|
||||
mgesture.numFingers,
|
||||
mgesture.timestamp);
|
||||
}
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_DETECTION) {
|
||||
SDL_Log("SD: mgestureSwipe = %i, time = %" SDL_PRIu64,
|
||||
gestureSwipe,
|
||||
(mgesture.timestamp - gestureStart.time) / 1000000);
|
||||
}
|
||||
if (gestureStart.time == 0) {
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_DETECTION) {
|
||||
SDL_Log("************ SD: Multigesture detection start **************");
|
||||
}
|
||||
gestureStart.time = mgesture.timestamp;
|
||||
gestureStart.point.x = mgesture.x;
|
||||
gestureStart.point.y = mgesture.y;
|
||||
lastVector.reset();
|
||||
gestureSwipe = false;
|
||||
} else {
|
||||
if (!gestureSwipe) {
|
||||
vector sv; // Vector from start point to current position
|
||||
float velocity;
|
||||
float theta; // Angle between current vector and previous vector.
|
||||
float duration;
|
||||
sv.w = mgesture.x - gestureStart.point.x;
|
||||
sv.h = mgesture.y - gestureStart.point.y;
|
||||
float distance = sv.length();
|
||||
if (lastVector.has_value()) {
|
||||
// SDL2 timestamps were in milliseconds, SDL3 are nanoseconds. Given the
|
||||
// normalized distances reported, using nanoseconds leads to 0 velocitySq.
|
||||
duration = static_cast<float>(
|
||||
(mgesture.timestamp - gestureStart.time) / 1000000.0);
|
||||
|
||||
velocity = distance / duration;
|
||||
assert(!std::isinf(velocity));
|
||||
theta = static_cast<float>(lastVector->getAngle(sv));
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_DETECTION) {
|
||||
SDL_Log("SD: Detection: distance = %f, velocity = %f, theta = %f, sv angle = %f, sv angle normalized = %f, lastv angle = %f",
|
||||
distance, velocity, theta,
|
||||
sv.getAngle(),
|
||||
sv.getAngleNormalized(),
|
||||
lastVector->getAngle());
|
||||
}
|
||||
lastVector = sv;
|
||||
// Multiple events with the same timestamp is a possibility
|
||||
// hence the isinf() check.
|
||||
if (std::abs(theta) < 3.0 && std::abs(mgesture.dDist) > 0.01 && !std::isinf(velocity) && velocity > 0.0007) {
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_DETECTION)
|
||||
SDL_Log("----------------- SD: Swipe %s detected -----------------",
|
||||
toString(sv.getDirection()).c_str());
|
||||
gestureSwipe = true;
|
||||
if (SDL_EventEnabled(SDL_EVENT_USER)) {
|
||||
SDL_Event user_event;
|
||||
// SDL will copy this entire struct! Initialize to keep memory
|
||||
// checkers happy.
|
||||
SDL_zero(user_event);
|
||||
user_event.type = SDL_EVENT_USER;
|
||||
user_event.user.code = swipeGesture;
|
||||
user_event.user.data1 = SwipeDetector::directionToPointer(sv.getDirection());
|
||||
user_event.user.data2 = NULL;
|
||||
SDL_PushEvent(&user_event);
|
||||
}
|
||||
} else {
|
||||
if (SWIPEDETECTOR_LOG_GESTURE_DETECTION) SDL_Log("SD: No swipe detected.");
|
||||
result = true;
|
||||
}
|
||||
} else {
|
||||
lastVector = sv;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2017-2020 Mark Callow, <khronos at callow dot im>.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _SWIPE_DETECTOR_H
|
||||
#define _SWIPE_DETECTOR_H
|
||||
#if defined(_WIN32)
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include "SDL_gesture.h"
|
||||
|
||||
class SwipeDetector {
|
||||
public:
|
||||
enum class Direction { up, down, left, right };
|
||||
|
||||
SwipeDetector() : gestureSwipe(false) {}
|
||||
bool doEvent(SDL_Event* event);
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
// Not clangcl
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4311)
|
||||
#pragma warning(disable : 4302)
|
||||
#pragma warning(disable : 4312)
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wvoid-pointer-to-int-cast"
|
||||
#endif
|
||||
// These conversions allow storing a Direction in a pointer.
|
||||
// Ugly. Horrible. But preferable to allocating and freeing memory
|
||||
// when passing the information in user events.
|
||||
static inline Direction pointerToDirection(void* p) {
|
||||
return static_cast<SwipeDetector::Direction>(reinterpret_cast<long>(p));
|
||||
}
|
||||
|
||||
// Only preserves the low 32-bits of the pointer; perfect for this use.
|
||||
static inline void* directionToPointer(SwipeDetector::Direction d) {
|
||||
return reinterpret_cast<void*>(static_cast<long>(d));
|
||||
}
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
static const Uint32 swipeGesture = 0x01;
|
||||
|
||||
class vector {
|
||||
public:
|
||||
float w;
|
||||
float h;
|
||||
|
||||
vector() : w(0.0), h(0.0) { }
|
||||
vector(float _w, float _h) : w(_w), h(_h) { }
|
||||
/**
|
||||
* @~English
|
||||
* @internal
|
||||
* @brief Find the angle between the vector and the X-axis
|
||||
*
|
||||
* Positive angles increase counter-clockwise from the X-axis
|
||||
* which has +x to the right.
|
||||
*
|
||||
* @return the angle between the vector and the x axis in degrees.
|
||||
*/
|
||||
double getAngle() {
|
||||
double rad = atan2(h, w);
|
||||
return rad * 180/M_PI;
|
||||
}
|
||||
|
||||
/**
|
||||
* @~English
|
||||
* @internal
|
||||
* @brief Find the angle between this vector and another.
|
||||
*
|
||||
* Positive angles increase counter-clockwise.
|
||||
*
|
||||
* @return the angle between the 2 vectors in degrees.
|
||||
*/
|
||||
double getAngle(const vector& v2) {
|
||||
// Reputed to be more accurate but in our use so far both approaches give same answer.
|
||||
//double rad = atan2f(v2.h, v2.w) - SDL_atan2(h, w);
|
||||
double rad = atan2f(w * v2.h - h * v2.w, w * v2.w + h * v2.h);
|
||||
return rad * 180/M_PI;
|
||||
}
|
||||
|
||||
/**
|
||||
* @~English
|
||||
* @internal
|
||||
* @brief Find the angle between the vector and the X-axis
|
||||
*
|
||||
* Positive angles increase counter-clockwise from the X-axis
|
||||
* which has +x to the right. Value is normalized to the range 0 to 360.
|
||||
*
|
||||
* @return the angle between the vector and the x axis in degrees.
|
||||
*/
|
||||
double getAngleNormalized() {
|
||||
double rad = atan2(h, w) + M_PI;
|
||||
return fmod(rad*180/M_PI + 180, 360);
|
||||
}
|
||||
|
||||
/**
|
||||
* @~English
|
||||
* @internal
|
||||
* @brief Return the length of the vector.
|
||||
*
|
||||
* @return the length of the vector.
|
||||
*/
|
||||
float length() { return sqrt(w * w + h * h); }
|
||||
|
||||
/**
|
||||
* @~English
|
||||
* @internal
|
||||
* @brief Return the direction of the vector.
|
||||
*
|
||||
* @return the direction
|
||||
*/
|
||||
Direction getDirection() {
|
||||
double angle = getAngleNormalized();
|
||||
return getDirection(angle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @~English
|
||||
* @internal
|
||||
* @brief Return a direction given an angle.
|
||||
*
|
||||
* Directions are defined as follows:
|
||||
*
|
||||
* Up: [45, 135]
|
||||
* Right: [0,45] and [315, 360]
|
||||
* Down: [225, 315]
|
||||
* Left: [135, 225]
|
||||
*
|
||||
* @param angle an angle from 0 to 360°
|
||||
* @return the direction of an angle
|
||||
*/
|
||||
static Direction getDirection(double angle){
|
||||
if (inRange(angle, 45, 135)) {
|
||||
return Direction::down;
|
||||
} else if (inRange(angle, 0, 45) || inRange(angle, 315, 360)) {
|
||||
return Direction::right;
|
||||
} else if (inRange(angle, 225, 315)) {
|
||||
return Direction::up;
|
||||
} else {
|
||||
return Direction::left;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @~English
|
||||
* @internal
|
||||
* @brief Check if angle falls within an interval.
|
||||
*
|
||||
* @param angle an angle
|
||||
* @param init the initial bound
|
||||
* @param end the final bound
|
||||
*
|
||||
* @return true if the given angle is in the interval [init, end), false
|
||||
* otherwise.
|
||||
*/
|
||||
static bool inRange(double angle, float init, float end){
|
||||
return (angle >= init) && (angle < end);
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
struct gestureStart {
|
||||
Uint64 time;
|
||||
SDL_FPoint point;
|
||||
gestureStart() { time = 0; point.x = point.y = 0.0; }
|
||||
} gestureStart;
|
||||
std::optional<vector> lastVector;
|
||||
bool gestureSwipe;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline std::string toString(SwipeDetector::Direction dir) {
|
||||
switch (dir) {
|
||||
case SwipeDetector::Direction::up: return "up";
|
||||
case SwipeDetector::Direction::down: return "down";
|
||||
case SwipeDetector::Direction::left: return "left";
|
||||
case SwipeDetector::Direction::right: return "right";
|
||||
// This is to hide a warning from MSVC. According to the solution given
|
||||
// in https://developercommunity.visualstudio.com/t/Visual-Studio-warning-on-Strongly-typed-/96302
|
||||
// it is possible to construct an enum class with any value. Thus warning.
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _SWIPE_DETECTOR_H */
|
||||
@@ -0,0 +1,61 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2017-2020 Mark Callow, <khronos at callow dot im>.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ktx.h>
|
||||
#include "TranscodeTargetStrToFmt.h"
|
||||
|
||||
ktx_transcode_fmt_e
|
||||
TranscodeTargetStrToFmt(std::string format)
|
||||
{
|
||||
if (!format.compare("ETC1_RGB"))
|
||||
return KTX_TTF_ETC1_RGB;
|
||||
else if (!format.compare("ETC2_RGBA"))
|
||||
return KTX_TTF_ETC2_RGBA;
|
||||
else if (!format.compare("BC1_RGB"))
|
||||
return KTX_TTF_BC1_RGB;
|
||||
else if (!format.compare("BC3_RGBA"))
|
||||
return KTX_TTF_BC3_RGBA;
|
||||
else if (!format.compare("BC4_R"))
|
||||
return KTX_TTF_BC4_R;
|
||||
else if (!format.compare("BC5_RG"))
|
||||
return KTX_TTF_BC5_RG;
|
||||
else if (!format.compare("BC7_M6_RGB"))
|
||||
return KTX_TTF_BC7_M6_RGB;
|
||||
else if (!format.compare("BC7_M5_RGBA"))
|
||||
return KTX_TTF_BC7_M5_RGBA;
|
||||
else if (!format.compare("PVRTC1_4_RGB"))
|
||||
return KTX_TTF_PVRTC1_4_RGB;
|
||||
else if (!format.compare("PVRTC1_4_RGBA"))
|
||||
return KTX_TTF_PVRTC1_4_RGBA;
|
||||
else if (!format.compare("ASTC_4x4_RGBA"))
|
||||
return KTX_TTF_ASTC_4x4_RGBA;
|
||||
else if (!format.compare("PVRTC2_4_RGB"))
|
||||
return KTX_TTF_PVRTC2_4_RGB;
|
||||
else if (!format.compare("PVRTC2_4_RGBA"))
|
||||
return KTX_TTF_PVRTC2_4_RGBA;
|
||||
else if (!format.compare("ETC2_EAC_R11"))
|
||||
return KTX_TTF_ETC2_EAC_R11;
|
||||
else if (!format.compare("ETC2_EAC_RG11"))
|
||||
return KTX_TTF_ETC2_EAC_RG11;
|
||||
else if (!format.compare("RGBA32"))
|
||||
return KTX_TTF_RGBA32;
|
||||
else if (!format.compare("RGB565"))
|
||||
return KTX_TTF_RGB565;
|
||||
else if (!format.compare("BGR565"))
|
||||
return KTX_TTF_BGR565;
|
||||
else if (!format.compare("RGBA4444"))
|
||||
return KTX_TTF_RGBA4444;
|
||||
else if (!format.compare("ETC"))
|
||||
return KTX_TTF_ETC;
|
||||
else if (!format.compare("BC1_OR_3"))
|
||||
return KTX_TTF_BC1_OR_3;
|
||||
assert(false); // Error in args in sample table.
|
||||
return static_cast<ktx_transcode_fmt_e>(-1); // To keep compilers happy.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2017-2020 Mark Callow, <khronos at callow dot im>.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _TRANSCODE_TARGET_STR_TO_FMT_
|
||||
#define _TRANSCODE_TARGET_STR_TO_FMT_
|
||||
|
||||
#include <string>
|
||||
|
||||
ktx_transcode_fmt_e TranscodeTargetStrToFmt(std::string format);
|
||||
|
||||
#endif /* _TRANSCODE_TARGET_STR_TO_FMT_ */
|
||||
@@ -0,0 +1,21 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2021 Mark Callow.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#if !defined DISABLE_GLM_WARNINGS_H
|
||||
|
||||
// Temporarily disable the warnings caused by the GLM code.
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4201)
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
|
||||
#pragma clang diagnostic ignored "-Wnested-anon-types"
|
||||
#endif
|
||||
|
||||
#endif /* DISABLE_GLM_WARNINGS_H */
|
||||
@@ -0,0 +1,66 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2018-2020 Mark Callow, <khronos at callow dot im>.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @file
|
||||
* @~English
|
||||
*
|
||||
* @brief Custom exceptions for the load tests.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#define OUT_OF_HOST_MEMORY -1
|
||||
#define OUT_OF_DEVICE_MEMORY -2
|
||||
#define FRAGMENTED_POOL -12
|
||||
#define OUT_OF_POOL_MEMORY -1000069000
|
||||
|
||||
class bad_vulkan_alloc : public std::bad_alloc {
|
||||
public:
|
||||
bad_vulkan_alloc(int which, const char* _message) : std::bad_alloc() {
|
||||
if (which == FRAGMENTED_POOL) {
|
||||
message << "Pool fragmented when allocating for " << _message << ".";
|
||||
} else {
|
||||
std::string memtype;
|
||||
switch (which) {
|
||||
case OUT_OF_HOST_MEMORY: memtype = "host"; break;
|
||||
case OUT_OF_DEVICE_MEMORY: memtype = "device"; break;
|
||||
case OUT_OF_POOL_MEMORY: memtype = "pool"; break;
|
||||
default: break;
|
||||
}
|
||||
message << "Out of " << memtype << " memory for " << _message << ".";
|
||||
}
|
||||
_what = message.str();
|
||||
}
|
||||
bad_vulkan_alloc(const bad_vulkan_alloc& in)
|
||||
: std::bad_alloc()
|
||||
, message{in.message.str()}
|
||||
, _what{in._what}
|
||||
{}
|
||||
virtual const char* what() const throw() {
|
||||
return _what.c_str();
|
||||
}
|
||||
protected:
|
||||
std::stringstream message;
|
||||
std::string _what;
|
||||
};
|
||||
|
||||
class unsupported_ttype : public std::runtime_error {
|
||||
public:
|
||||
unsupported_ttype()
|
||||
: std::runtime_error("Implementation does not support needed operations on image format") { }
|
||||
unsupported_ttype(std::string& message) : std::runtime_error(message) { }
|
||||
};
|
||||
|
||||
class unsupported_ctype : public std::runtime_error {
|
||||
public:
|
||||
unsupported_ctype()
|
||||
: std::runtime_error("Unsupported compression format") { }
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
# Copyright 2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Max2Obj Version 4.0 Mar 10th, 2001
|
||||
#
|
||||
# object default to come ...
|
||||
#
|
||||
v -5.000000 -5.000000 -5.000000
|
||||
v 5.000000 -5.000000 -5.000000
|
||||
v -5.000000 5.000000 -5.000000
|
||||
v 5.000000 5.000000 -5.000000
|
||||
v -5.000000 -5.000000 5.000000
|
||||
v 5.000000 -5.000000 5.000000
|
||||
v -5.000000 5.000000 5.000000
|
||||
v 5.000000 5.000000 5.000000
|
||||
# 8 vertices
|
||||
|
||||
vt 0.000000 0.000000 0.000000
|
||||
vt 1.000000 0.000000 0.000000
|
||||
vt 0.000000 1.000000 0.000000
|
||||
vt 1.000000 1.000000 0.000000
|
||||
vt 0.000000 0.000000 0.000000
|
||||
vt 1.000000 0.000000 0.000000
|
||||
vt 0.000000 1.000000 0.000000
|
||||
vt 1.000000 1.000000 0.000000
|
||||
vt 0.000000 0.000000 0.000000
|
||||
vt 1.000000 0.000000 0.000000
|
||||
vt 0.000000 1.000000 0.000000
|
||||
vt 1.000000 1.000000 0.000000
|
||||
# 12 texture vertices
|
||||
|
||||
vn 0.000000 0.000000 -2.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 0.000000 0.000000 -2.000000
|
||||
vn 0.000000 -0.000000 2.000000
|
||||
vn 0.000000 -0.000000 1.000000
|
||||
vn 0.000000 -0.000000 1.000000
|
||||
vn 0.000000 -0.000000 2.000000
|
||||
# 8 vertex normals
|
||||
|
||||
g default
|
||||
s 2
|
||||
f 1/10/1 3/12/3 4/11/4
|
||||
f 4/11/4 2/9/2 1/10/1
|
||||
s 4
|
||||
f 5/9/5 6/10/6 8/12/8
|
||||
f 8/12/8 7/11/7 5/9/5
|
||||
s 8
|
||||
f 1/5/1 2/6/2 6/8/6
|
||||
f 6/8/6 5/7/5 1/5/1
|
||||
s 16
|
||||
f 2/1/2 4/2/4 8/4/8
|
||||
f 8/4/8 6/3/6 2/1/2
|
||||
s 32
|
||||
f 4/5/4 3/6/3 7/8/7
|
||||
f 7/8/7 8/7/8 4/5/4
|
||||
s 64
|
||||
f 3/1/3 1/2/1 5/4/5
|
||||
f 5/4/5 7/3/7 3/1/3
|
||||
# 12 faces
|
||||
|
||||
g
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2020 The Khronos Group Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Blender User</author>
|
||||
<authoring_tool>Blender 2.77.0 commit date:2016-03-18, commit time:12:34, hash:22a2853</authoring_tool>
|
||||
</contributor>
|
||||
<created>2016-06-04T10:38:04</created>
|
||||
<modified>2016-06-04T10:38:04</modified>
|
||||
<unit name="meter" meter="1"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_images/>
|
||||
<library_geometries>
|
||||
<geometry id="Teapot-mesh" name="Teapot">
|
||||
<mesh>
|
||||
<source id="Teapot-mesh-positions">
|
||||
<float_array id="Teapot-mesh-positions-array" count="14070">0.1661389 -1.486528 0.6782799 0.1639019 -1.470384 0.7083578 -0.0398333 -1.483709 0.7083578 -0.0398333 -1.5 0.6782799 0.1615458 -1.453379 0.7329674 -0.0398333 -1.466551 0.7329674 0.1591659 -1.436203 0.7521081 -0.0398333 -1.449219 0.7521081 0.1568574 -1.419542 0.7657797 -0.0398333 -1.432407 0.7657797 0.1547158 -1.404086 0.773983 -0.0398333 -1.416811 0.773983 0.1528365 -1.390523 0.7767172 -0.0398333 -1.403125 0.7767172 0.1513147 -1.37954 0.773983 -0.0398333 -1.392043 0.773983 0.150246 -1.371827 0.7657797 -0.0398333 -1.384259 0.7657797 0.1497255 -1.36807 0.7521079 -0.0398333 -1.380469 0.7521079 0.1498486 -1.368959 0.7329671 -0.0398333 -1.381366 0.7329671 0.1507108 -1.375181 0.7083578 -0.0398333 -1.387645 0.7083578 0.1524074 -1.387426 0.6782799 -0.0398333 -1.4 0.6782799 0.3629445 -1.447222 0.6782799 0.3585702 -1.431505 0.7083578 0.3539628 -1.41495 0.7329674 0.3493087 -1.398228 0.7521081 0.3447946 -1.382008 0.7657797 0.3406068 -1.366961 0.773983 0.3369317 -1.353756 0.7767172 0.333956 -1.343064 0.773983 0.3318659 -1.335554 0.7657797 0.3308481 -1.331897 0.7521079 0.3310889 -1.332762 0.7329671 0.3327749 -1.33882 0.7083578 0.3360926 -1.350741 0.6782799 0.5489167 -1.38375 0.6782799 0.5425227 -1.368722 0.7083578 0.5357879 -1.352893 0.7329674 0.528985 -1.336904 0.7521081 0.5223866 -1.321396 0.7657797 0.5162652 -1.307008 0.773983 0.5108933 -1.294383 0.7767172 0.5065435 -1.28416 0.773983 0.5034885 -1.276979 0.7657797 0.5020006 -1.273482 0.7521079 0.5023528 -1.27431 0.7329671 0.5048173 -1.280102 0.7083578 0.5096667 -1.2915 0.6782799 0.7223889 -1.297778 0.6782799 0.714111 -1.283683 0.7083578 0.7053918 -1.268838 0.7329674 0.6965845 -1.253843 0.7521081 0.6880419 -1.239298 0.7657797 0.6801168 -1.225804 0.773983 0.6731621 -1.213963 0.7767172 0.6675307 -1.204375 0.773983 0.6635755 -1.197641 0.7657797 0.6616494 -1.194361 0.7521079 0.6621052 -1.195137 0.7329671 0.6652958 -1.20057 0.7083578 0.6715741 -1.211259 0.6782799 0.8816945 -1.190972 0.6782799 0.8716863 -1.178038 0.7083578 0.861145 -1.164414 0.7329674 0.8504969 -1.150653 0.7521081 0.8401688 -1.137305 0.7657797 0.8305874 -1.124922 0.773983 0.8221791 -1.114055 0.7767172 0.8153708 -1.105256 0.773983 0.8105889 -1.099076 0.7657797 0.8082602 -1.096067 0.7521079 0.8088113 -1.096779 0.7329671 0.8126688 -1.101764 0.7083578 0.8202593 -1.111574 0.6782799 1.025167 -1.065 0.6782799 1.0136 -1.053434 0.7083578 1.001418 -1.041251 0.7329674 0.989112 -1.028945 0.7521081 0.977176 -1.017009 0.7657797 0.9661028 -1.005936 0.773983 0.9563854 -0.9962188 0.7767172 0.9485172 -0.9883505 0.773983 0.9429908 -0.9828242 0.7657797 0.9402995 -0.9801328 0.7521079 0.9409363 -0.9807697 0.7329671 0.9453943 -0.9852278 0.7083578 0.9541667 -0.9940001 0.6782799 1.151139 -0.9215278 0.6782799 1.138204 -0.9115197 0.7083578 1.124581 -0.9009783 0.7329674 1.11082 -0.8903303 0.7521081 1.097472 -0.8800022 0.7657797 1.085089 -0.8704208 0.773983 1.074222 -0.8620126 0.7767172 1.065423 -0.8552041 0.773983 1.059243 -0.8504223 0.7657797 1.056233 -0.8480936 0.7521079 1.056946 -0.8486446 0.7329671 1.061931 -0.8525021 0.7083578 1.071741 -0.8600926 0.6782799 1.257945 -0.7622224 0.6782799 1.24385 -0.7539443 0.7083578 1.229005 -0.7452253 0.7329674 1.214009 -0.736418 0.7521081 1.199464 -0.7278753 0.7657797 1.185971 -0.7199501 0.773983 1.17413 -0.7129955 0.7767172 1.164542 -0.7073641 0.773983 1.157807 -0.7034088 0.7657797 1.154528 -0.7014827 0.7521079 1.155304 -0.7019385 0.7329671 1.160736 -0.7051292 0.7083578 1.171426 -0.7114075 0.6782799 1.343917 -0.5887501 0.6782799 1.328889 -0.582356 0.7083578 1.31306 -0.5756213 0.7329674 1.297071 -0.5688184 0.7521081 1.281562 -0.56222 0.7657797 1.267175 -0.5560985 0.773983 1.254549 -0.5507267 0.7767172 1.244326 -0.5463768 0.773983 1.237146 -0.5433219 0.7657797 1.233649 -0.541834 0.7521079 1.234477 -0.5421862 0.7329671 1.240269 -0.5446506 0.7083578 1.251667 -0.5495001 0.6782799 1.407389 -0.4027778 0.6782799 1.391671 -0.3984035 0.7083578 1.375117 -0.3937961 0.7329674 1.358394 -0.3891421 0.7521081 1.342175 -0.3846279 0.7657797 1.327127 -0.3804401 0.773983 1.313922 -0.376765 0.7767172 1.30323 -0.3737893 0.773983 1.295721 -0.3716993 0.7657797 1.292063 -0.3706815 0.7521079 1.292929 -0.3709223 0.7329671 1.298987 -0.3726083 0.7083578 1.310907 -0.3759259 0.6782799 1.446694 -0.2059722 0.6782799 1.43055 -0.2037353 0.7083578 1.413546 -0.2013791 0.7329674 1.396369 -0.1989992 0.7521081 1.379709 -0.1966907 0.7657797 1.364253 -0.1945492 0.773983 1.35069 -0.1926698 0.7767172 1.339707 -0.1911481 0.773983 1.331993 -0.1900793 0.7657797 1.328237 -0.1895588 0.7521079 1.329126 -0.189682 0.7329671 1.335348 -0.1905442 0.7083578 1.347592 -0.1922407 0.6782799 1.460167 0 0.6782799 1.443876 0 0.7083578 1.426718 0 0.7329674 1.409385 0 0.7521081 1.392574 0 0.7657797 1.376978 0 0.773983 1.363292 0 0.7767172 1.35221 0 0.773983 1.344426 0 0.7657797 1.340635 0 0.7521079 1.341532 0 0.7329671 1.347811 0 0.7083578 1.360167 0 0.6782799 -1.526361 -0.2059722 0.6782799 -Line truncated
|
||||
<technique_common>
|
||||
<accessor source="#Teapot-mesh-positions-array" count="4690" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="Teapot-mesh-normals">
|
||||
<float_array id="Teapot-mesh-normals-array" count="14058">0.1114252 -0.8443715 0.5240432 0 -0.8917934 0.452443 0.116643 -0.8840392 0.4526249 0.1024546 -0.7765125 0.6217166 0 -0.8517999 0.5238676 0.09021556 -0.6836668 0.7241967 0 -0.7833697 0.6215562 0.07239204 -0.5488917 0.8327528 0 -0.6897467 0.7240509 0.04434382 -0.3363786 0.9406822 0 -0.5537984 0.8326508 -0.001770079 0.01309245 0.9999127 0 -0.3394067 0.9406397 -0.06460899 0.4894354 0.8696429 0 0.01327556 0.9999119 -0.1135018 0.8603431 0.4969176 0 0.4939156 0.8695099 -0.1299511 0.9851322 0.112372 0 0.8679181 0.4967074 0 0.9889301 -0.1483822 0 0.9936733 0.1123105 -0.1293399 0.9804262 -0.1484449 0 0.9490154 -0.3152296 -0.1241223 0.9408208 -0.3153567 0 0.925002 -0.3799622 0.221356 -0.8221883 0.524412 0.231767 -0.8608707 0.4529742 0.2035357 -0.7560334 0.6220825 0.1791804 -0.6655403 0.7245346 0.1438066 -0.5342698 0.832992 0.0880779 -0.3273776 0.9407796 -0.003479123 0.01272624 0.999913 -0.1283012 0.4763992 0.8698177 -0.2255075 0.837787 0.4972519 -0.2582858 0.9595 0.112464 -0.2570599 0.9549029 -0.148596 -0.2466598 0.9162609 -0.3156342 -0.1210998 0.9169772 -0.3801155 0.3271652 -0.7858374 0.5248072 0.3425838 -0.8228726 0.4533399 0.300796 -0.7225086 0.6224976 0.2647531 -0.6359569 0.7248895 0.2124758 -0.510406 0.8332706 0.1301324 -0.3126963 0.9408968 -0.005127131 0.01217693 0.9999127 -0.1895549 0.4551943 0.8699812 -0.3333597 0.8008202 0.4975523 -0.381855 0.9173431 0.1125544 -0.3800569 0.9129239 -0.148751 -0.3646467 0.8759089 -0.3159376 -0.2405499 0.8929827 -0.380418 0.4268109 -0.7362449 0.5251437 0.4469462 -0.7709937 0.4536604 0.3923883 -0.6768599 0.62281 0.3453207 -0.5956972 0.7251886 0.2770882 -0.4780297 0.8334925 0.1696864 -0.2928006 0.9409965 -0.006683528 0.01144444 0.9999123 -0.2472065 0.4263855 0.8701061 -0.4349359 0.7503262 0.4978369 -0.4982846 0.8596608 0.1126763 -0.4959087 0.8555181 -0.1488733 -0.4757861 0.8207692 -0.3161734 -0.3554937 0.853606 -0.380764 0.5187014 -0.674501 0.5253545 0.5432077 -0.7063622 0.453848 0.4768334 -0.6200605 0.6230208 0.4196117 -0.5456569 0.7253859 0.3366887 -0.4378296 0.8336341 0.206187 -0.2681409 0.9410566 -0.008117914 0.0104984 0.999912 -0.3003712 0.3905557 0.8701974 -0.5286319 0.6874259 0.49799 -0.6057094 0.7876633 0.1127064 -0.6028164 0.7838566 -0.148934 -0.5783084 0.7519932 -0.3163316 -0.4637703 0.7998175 -0.3810631 0.601634 -0.601634 0.5254265 0.6300659 -0.6300659 0.4539099 0.5530375 -0.5530681 0.6231095 0.48669 -0.48669 0.7254418 0.3904905 -0.3904905 0.8336873 0.2391173 -0.2391173 0.9410876 -0.009399712 0.009399712 0.9999117 -0.3483726 0.3483726 0.8702145 -0.6131674 0.6131674 0.4980478 -0.702599 0.702599 0.1127356 -0.6992175 0.6992175 -0.1489625 -0.6707881 0.6707881 -0.3163651 -0.5636098 0.7328117 -0.3812232 0.7063469 -0.5432193 0.4538578 0.674501 -0.5187014 0.5253545 0.6200605 -0.4768334 0.6230208 0.5456569 -0.4196117 0.7253859 0.4378296 -0.3366887 0.8336341 0.2681409 -0.206187 0.9410566 -0.0104984 0.008117914 0.999912 -0.3905557 0.3003712 0.8701974 -0.6874259 0.5286319 0.49799 -0.7838566 0.6028164 -0.148934 -0.7876633 0.6057094 0.1127064 -0.7519932 0.5783084 -0.3163316 -0.7328117 0.5636098 -0.3812232 0.7709937 -0.4469462 0.4536604 0.7362449 -0.4268109 0.5251437 0.6768599 -0.3923883 0.62281 0.5956972 -0.3453207 0.7251886 0.4780297 -0.2770882 0.8334925 0.2928006 -0.1696864 0.9409965 -0.01144444 0.006683528 0.9999123 -0.4263855 0.2472065 0.8701061 -0.7503262 0.4349359 0.4978369 -0.8555181 0.4959087 -0.1488733 -0.8596637 0.4982863 0.1126462 -0.8207692 0.4757861 -0.3161734 -0.7998175 0.4637703 -0.3810631 0.8228726 -0.3425838 0.4533399 0.7858374 -0.3271652 0.5248072 0.7225086 -0.300796 0.6224976 0.6359569 -0.2647531 0.7248895 0.510406 -0.2124758 0.8332706 0.3126963 -0.1301324 0.9408968 -0.01217693 0.005127131 0.9999127 -0.4551969 0.1895255 0.8699861 -0.8008202 0.3333597 0.4975523 -0.9129239 0.3800569 -0.148751 -0.9173431 0.381855 0.1125544 -0.8759089 0.3646467 -0.3159376 -0.853596 0.3554895 -0.3807901 0.8608707 -0.231767 0.4529742 0.8221883 -0.221356 0.524412 0.7560334 -0.2035357 0.6220825 0.6655403 -0.1791804 0.7245346 0.5342479 -0.143809 0.8330056 0.3273776 -0.0880779 0.9407796 -0.01272624 0.003479123 0.999913 -0.4763992 0.1283012 0.8698177 -0.837787 0.2255075 0.4972519 -0.9549029 0.2570599 -0.148596 -0.9595 0.2582858 0.112464 -0.9162609 0.2466598 -0.3156342 -0.8929827 0.2405499 -0.380418 0.884036 -0.1166731 0.4526233 0.8443715 -0.1114252 0.5240432 0.7765125 -0.1024546 0.6217166 0.6836668 -0.09021556 0.7241967 0.5488917 -0.07239204 0.8327528 0.3364154 -0.04434466 0.9406691 -0.01306194 0.001770079 0.9999132 -0.4894354 0.06460899 0.8696429 -0.8603431 0.1135018 0.4969176 -0.9804262 0.1293399 -0.1484449 -0.9851322 0.1299511 0.112372 -0.9408208 0.1241223 -0.3153567 -0.9169772 0.1210998 -0.3801155 0.8917934 0 0.452443 0.8517999 0 0.5238676 0.7833697 0 0.6215562 0.6897314 0 0.7240654 0.5537984 0 0.8326508 0.3394067 0 0.9406397 -0.01327556 0 0.9999119 -0.4938925 0 0.8695231 -0.8679049 0 0.4967305 -0.9889301 0 -0.1483822 -0Line truncated
|
||||
<technique_common>
|
||||
<accessor source="#Teapot-mesh-normals-array" count="4686" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="Teapot-mesh-vertices">
|
||||
<input semantic="POSITION" source="#Teapot-mesh-positions"/>
|
||||
</vertices>
|
||||
<polylist count="9128">
|
||||
<input semantic="VERTEX" source="#Teapot-mesh-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#Teapot-mesh-normals" offset="1"/>
|
||||
<vcount>3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3Line truncated
|
||||
<p>1 0 3 1 0 2 4 3 2 4 1 0 6 5 5 6 4 3 8 7 7 8 6 5 10 9 9 10 8 7 12 11 11 12 10 9 14 13 13 14 12 11 16 15 15 16 14 13 18 17 17 18 16 15 18 17 21 19 19 20 20 21 23 22 21 19 22 23 25 24 23 22 27 25 0 2 26 26 28 27 1 0 27 25 29 28 4 3 28 27 30 29 6 5 29 28 31 30 8 7 30 29 32 31 10 9 31 30 33 32 12 11 32 31 34 33 14 13 33 32 35 34 16 15 34 33 35 34 20 21 18 17 36 35 22 23 20 21 37 36 24 37 22 23 40 38 26 26 39 39 41 40 27 25 40 38 42 41 28 27 41 40 43 42 29 28 42 41 44 43 30 29 43 42 45 44 31 30 44 43 46 45 32 31 45 44 47 46 33 32 46 45 48 47 34 33 47 46 48 47 36 35 35 34 49 48 37 36 36 35 50 49 38 50 37 36 53 51 39 39 52 52 54 53 40 38 53 51 55 54 41 40 54 53 56 55 42 41 55 54 57 56 43 42 56 55 58 57 44 43 57 56 59 58 45 44 58 57 60 59 46 45 59 58 61 60 47 46 60 59 61 60 49 48 48 47 62 61 50 49 49 48 63 62 51 63 50 49 66 64 52 52 65 65 67 66 53 51 66 64 68 67 54 53 67 66 69 68 55 54 68 67 70 69 56 55 69 68 71 70 57 56 70 69 72 71 58 57 71 70 73 72 59 58 72 71 74 73 60 59 73 72 74 73 62 61 61 60 75 74 63 62 62 61 76 75 64 76 63 62 79 77 65 65 78 78 80 79 66 64 79 77 81 80 67 66 80 79 82 81 68 67 81 80 83 82 69 68 82 81 84 83 70 69 83 82 85 84 71 70 84 83 86 85 72 71 85 84 87 86 73 72 86 85 87 86 75 74 74 73 88 87 76 75 75 74 89 88 77 89 76 75 91 90 79 77 78 78 92 91 80 79 79 77 93 92 81 80 80 79 94 93 82 81 81 80 95 94 83 82 82 81 96 95 84 83 83 82 97 96 85 84 84 83 98 97 86 85 85 84 99 98 87 86 86 85 101 99 87 86 100 100 102 101 88 87 101 99 103 102 89 88 102 101 104 103 92 91 91 90 105 104 93 92 92 91 106 105 94 93 93 92 107 106 95 94 94 93 108 107 96 95 95 94 109 108 97 96 96 95 110 109 98 97 97 96 111 110 99 98 98 97 112 111 100 100 99 98 114 112 100 100 113 113 115 114 101 99 114 112 116 115 102 101 115 114 117 116 105 104 104 103 118 117 106 105 105 104 119 118 107 106 106 105 120 119 108 107 107 106 121 120 109 108 108 107 122 121 110 109 109 108 123 122 111 110 110 109 124 123 112 111 111 110 125 124 113 113 112 111 127 125 113 113 126 126 128 127 114 112 127 125 129 128 115 114 128 127 130 129 118 117 117 116 131 130 119 118 118 117 132 131 120 119 119 118 133 132 121 120 120 119 134 133 122 121 121 120 135 134 123 122 122 121 136 135 124 123 123 122 137 136 125 124 124 123 138 137 126 126 125 124 140 138 126 126 139 139 141 140 127 125 140 138 142 141 128 127 141 140 143 142 131 130 130 129 144 143 132 131 131 130 145 144 133 132 132 131 146 145 134 133 133 132 147 146 135 134 134 133 148 147 136 135 135 134 149 148 137 136 136 135 150 149 138 137 137 136 151 150 139 139 138 137 153 151 139 139 152 152 154 153 140 138 153 151 155 154 141 140 154 153 156 155 144 143 143 142 157 156 145 144 144 143 158 157 146 145 145 144 159 158 147 146 146 145 160 159 148 147 147 146 161 160 149 148 148 147 162 161 150 149 149 148 163 162 151 150 150 149 164 163 152 152 151 150 166 164 152 152 165 165 167 166 153 151 166 164 168 167 154 153 167 166 170 168 172 169 169 170 173 171 171 172 170 168 175 173 174 174 173 171 177 175 176 176 175 173 179 177 178 178 177 175 181 179 180 180 179 177 183 181 182 182 181 179 185 183 184 184 183 181 187 185 186 186 185 183 187 185 190 187 188 188 189 189 192 190 190 187 191 191 194 192 192 190 196 193 169 170 195 194 197 195 170 168 196 193 198 196 173 171 197 195 199 197 175 173 198 196 200 198 177 175 199 197 201 199 179 177 200 198 202 200 181 179 201 199 203 201 183 181 202 200 204 202 185 183 203 201 204 202 189 189 187 185 205 203 191 191 189 189 206 204 193 205 191 191 209 206 195 194 208 207 210 208 196 193 209 206 211 209 197 195 210 208 212 210 198 196 211 209 213 211 199 197 212 210 214 212 200 198 213 211 215 213 201 199 214 212 216 214 202 200 215 213 217 215 203 201 216 214 217 215 205 203 204 202 218 216 206 204 205 203 219 217 207 218 206 204 222 219 208 207 221 220 223 221 209 206 222 219 224 222 210 208 223 221 225 223 211 209 224 222 226 224 212 210 225 223 227 225 213 211 226 224 228 226 214 212 227 225 229 227 215 213 228 226 230 228 216 214 229 227 230 228 218 216 217 215 231 229 219 217 218 216 232 230 220 231 219 217 235 232 221 220 234 233 236 234 222 219 235 232 237 235 223 221 236 234 238 236 224 222 237 235 239 237 225 223 238 236 240 238 226 224 239 237 241 239 227 225 240 238 242 240 228 226 241 239 243 241 229 227 242 240 243 241 231 229 230 228 244 242 232 230 231 229 245 243 233 244 232 230 248 245 234 233 247 246 249 247 235 232 248 245 250 248 236 234 249 247 251 249 237 235 250 248 252 250 238 236 251 249 253 251 239 237 252 250 254 252 240 238 253 251 255 253 241 239 254 252 256 254 242 240 255 253 256 254 244 242 243 241 257 255 245 243 244 242 258 256 246 257 245 243 260 258 248 245 247 246 261 259 249 247 248 245 262 260 250 248 249 247 263 261 251 249 250 248 264 262 252 250 251 249 265 263 253 251 252 250 266 264 254 252 253 251 267 265 255 253 254 252 268 266 256 254 255 253 270 267 256 254 269 268 271 269 257 255 270 267 272 270 258 256 271 269 273 271 261 259 260 258 274 272 262 260 261 259 275 273 263 261 262 260 276 274 264Line truncated
|
||||
</polylist>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_controllers/>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="Scene" name="Scene">
|
||||
<node id="Teapot" name="Teapot" type="NODE">
|
||||
<matrix sid="transform">10 0 0 0 0 10 0 3e-8 0 0 10 0 0 0 0 1</matrix>
|
||||
<instance_geometry url="#Teapot-mesh" name="Teapot"/>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#Scene"/>
|
||||
</scene>
|
||||
</COLLADA>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,18 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2021 Mark Callow.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#if !defined REENABLE_WARNINGS_H
|
||||
|
||||
// Reenable warnings disabled by, e.g. disable_glm_warnings.h.
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif /* REENABLE_WARNINGS_H */
|
||||
@@ -0,0 +1,448 @@
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
|
||||
/*
|
||||
* Copyright 2016-2020 Mark Callow
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef VECMATH_9B7E1CFE346D11E6AFA2D7DC87495A69_H
|
||||
#define VECMATH_9B7E1CFE346D11E6AFA2D7DC87495A69_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @~English
|
||||
*
|
||||
* @brief Vector math package modelled after GLSL.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
struct vec2 {
|
||||
// Anonymous unions are portable.
|
||||
union {
|
||||
float x;
|
||||
float r;
|
||||
};
|
||||
union {
|
||||
float y;
|
||||
float g;
|
||||
};
|
||||
|
||||
vec2() { };
|
||||
};
|
||||
|
||||
struct vec3 {
|
||||
union {
|
||||
float x;
|
||||
float r;
|
||||
};
|
||||
union {
|
||||
float y;
|
||||
float g;
|
||||
};
|
||||
union {
|
||||
float z;
|
||||
float b;
|
||||
};
|
||||
|
||||
vec3() { }
|
||||
|
||||
vec3(float x, float y, float z) : x(x), y(y), z(z) { }
|
||||
|
||||
vec3(const vec3& value)
|
||||
: x(value.x), y(value.y), z(value.z) { }
|
||||
|
||||
vec3 operator-() const
|
||||
{
|
||||
return vec3(-x, -y, -z);
|
||||
}
|
||||
|
||||
vec3 operator-(const vec3& value) const
|
||||
{
|
||||
return vec3(this->x - value.x, this->y - value.y, this->z - value.z);
|
||||
}
|
||||
|
||||
vec3 operator/(float divisor) const
|
||||
{
|
||||
return vec3(x / divisor, y / divisor, z / divisor);
|
||||
}
|
||||
|
||||
vec3& operator/=(float divisor)
|
||||
{
|
||||
x /= divisor;
|
||||
y /= divisor;
|
||||
z /= divisor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
vec3& operator=(const vec3& value)
|
||||
{
|
||||
x = value.x;
|
||||
y = value.y;
|
||||
z = value.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float operator[](int i) const
|
||||
{
|
||||
switch (i) {
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
default:
|
||||
assert(false);
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
float& operator[](int i)
|
||||
{
|
||||
switch (i) {
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
default:
|
||||
assert(false);
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
vec3 cross(const vec3& value) const
|
||||
{
|
||||
return vec3::cross(*this, value);
|
||||
}
|
||||
|
||||
float dot(const vec3& vec) const
|
||||
{
|
||||
return vec3::dot(*this, vec);
|
||||
}
|
||||
|
||||
float length() const
|
||||
{
|
||||
return sqrt(dot(*this));
|
||||
}
|
||||
|
||||
vec3& normalize()
|
||||
{
|
||||
float length = this->length();
|
||||
return (length > 0.0f ? *this /= length : *this);
|
||||
}
|
||||
|
||||
static vec3 cross(const vec3& a, const vec3& b)
|
||||
{
|
||||
return vec3(a.y * b.z - a.z * b.y,
|
||||
a.z * b.x - a.x * b.z,
|
||||
a.x * b.y - a.y * b.x);
|
||||
}
|
||||
|
||||
static float dot(const vec3& a, const vec3& b)
|
||||
{
|
||||
return a.x * b.x + a.y * b.y + a.z * b.z;
|
||||
}
|
||||
|
||||
static vec3 normalize (const vec3& input)
|
||||
{
|
||||
float length = input.length();
|
||||
return (length > 0.0f ? input / length : input);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct vec4 {
|
||||
|
||||
union {
|
||||
float x;
|
||||
float r;
|
||||
};
|
||||
union {
|
||||
float y;
|
||||
float g;
|
||||
};
|
||||
union {
|
||||
float z;
|
||||
float b;
|
||||
};
|
||||
union {
|
||||
float w;
|
||||
float a;
|
||||
};
|
||||
|
||||
vec4() { }
|
||||
|
||||
vec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) { }
|
||||
|
||||
vec4(const vec3& value, float w)
|
||||
: x(value.x), y(value.y), z(value.z), w(w) { }
|
||||
|
||||
vec4(const vec4& value)
|
||||
: x(value.x), y(value.y), z(value.z), w(value.w) { }
|
||||
|
||||
vec4 operator/(float divisor) const
|
||||
{
|
||||
return vec4(x / divisor, y / divisor, z / divisor, w / divisor);
|
||||
}
|
||||
|
||||
vec4& operator/=(float divisor)
|
||||
{
|
||||
x /= divisor;
|
||||
y /= divisor;
|
||||
z /= divisor;
|
||||
w /= divisor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
vec4 operator*(float multiplicand) const
|
||||
{
|
||||
return vec4(x * multiplicand, y * multiplicand, z * multiplicand,
|
||||
w * multiplicand);
|
||||
}
|
||||
|
||||
vec4& operator=(const vec4& value)
|
||||
{
|
||||
x = value.x;
|
||||
y = value.y;
|
||||
z = value.z;
|
||||
w = value.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float operator[](int i) const
|
||||
{
|
||||
switch (i) {
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
default:
|
||||
assert(false);
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
float& operator[](int i)
|
||||
{
|
||||
switch (i) {
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
default:
|
||||
assert(false);
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
float dot(const vec4& vec) const
|
||||
{
|
||||
return vec4::dot(*this, vec);
|
||||
}
|
||||
|
||||
float length() const
|
||||
{
|
||||
return sqrt(dot(*this));
|
||||
}
|
||||
|
||||
static float dot(const vec4& a, const vec4& b)
|
||||
{
|
||||
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
||||
}
|
||||
|
||||
static vec4 normalize (const vec4& input)
|
||||
{
|
||||
float length = input.length();
|
||||
return (length > 0.0f ? input / length : input);
|
||||
}
|
||||
};
|
||||
|
||||
struct mat3 {
|
||||
vec3 m[3];
|
||||
|
||||
mat3()
|
||||
{
|
||||
m[0] = vec3(1.0f, 0.0f, 0.0f);
|
||||
m[1] = vec3(0.0f, 1.0f, 0.0f);
|
||||
m[2] = vec3(0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
mat3(const vec3& value1, const vec3& value2, const vec3& value3)
|
||||
{
|
||||
m[0] = value1;
|
||||
m[1] = value2;
|
||||
m[2] = value3;
|
||||
}
|
||||
|
||||
mat3 transpose() const
|
||||
{
|
||||
return mat3(vec3(m[0].x, m[1].x, m[2].x),
|
||||
vec3(m[0].y, m[1].y, m[2].y),
|
||||
vec3(m[0].z, m[1].z, m[2].z));
|
||||
}
|
||||
};
|
||||
|
||||
struct mat4 {
|
||||
vec4 m[4];
|
||||
|
||||
mat4()
|
||||
{
|
||||
m[0] = vec4(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
m[1] = vec4(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
m[2] = vec4(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
m[3] = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
mat4(const vec4& value1, const vec4& value2,
|
||||
const vec4& value3, const vec4& value4)
|
||||
{
|
||||
m[0] = value1;
|
||||
m[1] = value2;
|
||||
m[2] = value3;
|
||||
m[3] = value4;
|
||||
}
|
||||
|
||||
mat4 operator*(float value) const
|
||||
{
|
||||
return mat4(m[0] * value, m[1] * value, m[2] * value, m[3] * value);
|
||||
}
|
||||
|
||||
mat4 operator*(const mat4& value) const
|
||||
{
|
||||
mat4 right = value.transpose();
|
||||
return mat4(
|
||||
vec4(m[0].dot(right.m[0]), m[0].dot(right.m[1]),
|
||||
m[0].dot(right.m[2]), m[0].dot(right.m[3])),
|
||||
vec4(m[1].dot(right.m[0]), m[1].dot(right.m[1]),
|
||||
m[1].dot(right.m[2]), m[1].dot(right.m[3])),
|
||||
vec4(m[2].dot(right.m[0]), m[2].dot(right.m[1]),
|
||||
m[2].dot(right.m[2]), m[2].dot(right.m[3])),
|
||||
vec4(m[3].dot(right.m[0]), m[3].dot(right.m[1]),
|
||||
m[3].dot(right.m[2]), m[3].dot(right.m[3]))
|
||||
);
|
||||
}
|
||||
|
||||
vec4 operator*(const vec4& value) const
|
||||
{
|
||||
return vec4(m[0].dot(value), m[1].dot(value),
|
||||
m[2].dot(value), m[3].dot(value));
|
||||
}
|
||||
|
||||
vec4& operator[](int i)
|
||||
{
|
||||
return m[i];
|
||||
}
|
||||
|
||||
mat4 transpose() const
|
||||
{
|
||||
return mat4(vec4(m[0][0], m[1][0], m[2][0], m[3][0]),
|
||||
vec4(m[0][1], m[1][1], m[2][1], m[3][1]),
|
||||
vec4(m[0][2], m[1][2], m[2][2], m[3][2]),
|
||||
vec4(m[0][3], m[1][3], m[2][3], m[3][3]));
|
||||
}
|
||||
|
||||
static mat4 translate(const vec3& trans)
|
||||
{
|
||||
return mat4(vec4(1.0f, 0.0f, 0.0f, trans.x),
|
||||
vec4(0.0f, 1.0f, 0.0f, trans.y),
|
||||
vec4(0.0f, 0.0f, 1.0f, trans.z),
|
||||
vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
static mat4 translate(float x, float y, float z)
|
||||
{
|
||||
return mat4(vec4(1.0f, 0.0f, 0.0f, x),
|
||||
vec4(0.0f, 1.0f, 0.0f, y),
|
||||
vec4(0.0f, 0.0f, 1.0f, z),
|
||||
vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
static mat4 scale(const vec3& scale)
|
||||
{
|
||||
return mat4(vec4(scale.x, 0.0f, 0.0f, 0.0f),
|
||||
vec4(0.0f, scale.y, 0.0f, 0.0f),
|
||||
vec4(0.0f, 0.0f, scale.z, 0.0f),
|
||||
vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
static mat4 scale(float x, float y, float z)
|
||||
{
|
||||
return mat4(vec4(x, 0.0f, 0.0f, 0.0f),
|
||||
vec4(0.0f, y, 0.0f, 0.0f),
|
||||
vec4(0.0f, 0.0f, z, 0.0f),
|
||||
vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
static mat4 frustum(float left, float right, float bottom, float top,
|
||||
float zNear, float zFar)
|
||||
{
|
||||
return mat4(
|
||||
vec4(2.0f * zNear / (right - left), 0.0f,
|
||||
(right + left) / (right - left), 0.0f),
|
||||
vec4(0.0f, 2.0f * zNear / (top - bottom),
|
||||
(top + bottom) / (top - bottom), 0.0f),
|
||||
vec4(0.0f, 0.0f, (zFar + zNear) / (zNear - zFar),
|
||||
2.0f * zFar * zNear / (zNear - zFar)),
|
||||
vec4(0.0f, 0.0f, -1.0f, 0.0f)
|
||||
);
|
||||
}
|
||||
|
||||
static mat4 ortho(float left, float right, float bottom, float top,
|
||||
float zNear, float zFar)
|
||||
{
|
||||
return mat4(
|
||||
vec4(2.0f / (right - left), 0.0f, 0.0f,
|
||||
(right + left) / (left - right)),
|
||||
vec4(0.0f, 2.0f / (top - bottom), 0.0f,
|
||||
(top + bottom) / (bottom - top)),
|
||||
vec4(0.0f, 0.0f, 2.0f / (zNear - zFar),
|
||||
(zFar + zNear) / (zNear - zFar)),
|
||||
vec4(0.0f, 0.0f, 0.0f, 1.0f)
|
||||
);
|
||||
}
|
||||
|
||||
static mat4 lookAt(const vec3& eye, const vec3& center, const vec3& up)
|
||||
{
|
||||
vec3 const forward(vec3::normalize(center - eye));
|
||||
vec3 const side(vec3::normalize(vec3::cross(forward, up)));
|
||||
vec3 const u(vec3::cross(side, forward));
|
||||
|
||||
mat4 result;
|
||||
result[0][0] = side.x;
|
||||
result[1][0] = side.y;
|
||||
result[2][0] = side.z;
|
||||
result[0][1] = u.x;
|
||||
result[1][1] = u.y;
|
||||
result[2][1] = u.z;
|
||||
result[0][2] =-forward.x;
|
||||
result[1][2] =-forward.y;
|
||||
result[2][2] =-forward.z;
|
||||
result[3][0] =-vec3::dot(side, eye);
|
||||
result[3][1] =-vec3::dot(u, eye);
|
||||
result[3][2] = vec3::dot(forward, eye);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static mat4 lookAt(float eyeX, float eyeY, float eyeZ,
|
||||
float centerX, float centerY, float centerZ,
|
||||
float upX, float upY, float upZ)
|
||||
{
|
||||
return mat4::lookAt(vec3(eyeX, eyeY, eyeZ),
|
||||
vec3(centerX, centerY, centerZ),
|
||||
vec3(upX, upY, upZ));
|
||||
}
|
||||
|
||||
static mat4 perspective(float fovY, float aspect, float zNear, float zFar)
|
||||
{
|
||||
float scaleY = 1.0f / tan(fovY * 3.1415962f / 360.0f);
|
||||
return mat4(
|
||||
vec4(scaleY / aspect, 0.0f, 0.0f, 0.0f),
|
||||
vec4(0.0f, scaleY, 0.0f, 0.0f),
|
||||
vec4(0.0f, 0.0f, (zFar + zNear) / (zNear - zFar),
|
||||
(2.0f * zFar * zNear) / (zNear - zFar)),
|
||||
vec4(0.0f, 0.0f, -1.0f, 0.0f)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* VECMATH_9B7E1CFE-346D-11E6-AFA2-D7DC87495A69_H */
|
||||
Reference in new issue
Block a user