Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ==============================================================================
- This is an automatically generated GUI class created by the Introjucer!
- Be careful when adding custom code to these files, as only the code within
- the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
- and re-saved.
- Created with Introjucer version: 3.1.1
- ------------------------------------------------------------------------------
- The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
- Copyright 2004-13 by Raw Material Software Ltd.
- ==============================================================================
- */
- #ifndef __JUCE_HEADER_F4EEA1EAFD405FD4__
- #define __JUCE_HEADER_F4EEA1EAFD405FD4__
- //[Headers] -- You can add your own extra header files here --
- #include "JuceHeader.h"
- #include "CPIComponent.h"
- #include "WavefrontObjParser.h"
- struct Attributes;
- struct Uniforms;
- struct Shape;
- struct DemoTexture
- {
- virtual ~DemoTexture() {}
- virtual bool applyTo(OpenGLTexture&) = 0;
- String name;
- };
- //struct BackgroundStar;
- //struct SlowerBouncingNumber;
- struct BouncingNumber
- {
- BouncingNumber()
- : speed(0.0004 + 0.0007 * Random::getSystemRandom().nextDouble()),
- phase(Random::getSystemRandom().nextDouble())
- {
- }
- float getValue() const
- {
- double v = fmod(phase + speed * Time::getMillisecondCounterHiRes(), 2.0);
- return (float)(v >= 1.0 ? (2.0 - v) : v);
- }
- protected:
- double speed, phase;
- };
- struct SlowerBouncingNumber : public BouncingNumber
- {
- SlowerBouncingNumber()
- {
- speed *= 0.3;
- }
- };
- struct BackgroundStar
- {
- SlowerBouncingNumber x, y, hue, angle;
- };
- static Image resizeImageToPowerOfTwo(Image image)
- {
- if (!(isPowerOfTwo(image.getWidth()) && isPowerOfTwo(image.getHeight())))
- return image.rescaled(jmin(1024, nextPowerOfTwo(image.getWidth())),
- jmin(1024, nextPowerOfTwo(image.getHeight())));
- return image;
- }
- struct BuiltInTexture : public DemoTexture
- {
- BuiltInTexture(const char* nm, const void* imageData, size_t imageSize)
- : image(resizeImageToPowerOfTwo(ImageFileFormat::loadFrom(imageData, imageSize)))
- {
- name = nm;
- }
- Image image;
- bool applyTo(OpenGLTexture& texture)
- {
- texture.loadImage(image);
- return false;
- }
- };
- //[/Headers]
- //==============================================================================
- /**
- //[Comments]
- An auto-generated component, created by the Introjucer.
- Describe your class and how it works here!
- //[/Comments]
- */
- class HeadAnimation : public CPIComponent,
- private OpenGLRenderer
- {
- public:
- //==============================================================================
- HeadAnimation ();
- ~HeadAnimation();
- //==============================================================================
- //[UserMethods] -- You can add your own custom methods in this section.
- //[/UserMethods]
- void paint (Graphics& g);
- void resized();
- private:
- //[UserVariables] -- You can add your own custom variables in this section.
- void renderOpenGL();
- void newOpenGLContextCreated();
- void openGLContextClosing();
- void freeAllContextObjects();
- void setTexture(DemoTexture* t);
- Matrix3D<float> getProjectionMatrix() const;
- Matrix3D<float> getViewMatrix() const;
- void updateShader();
- void drawBackground2DStuff(float desktopScale);
- void selectTexture(int itemID);
- void setShaderProgram(const String& vertexShader, const String& fragmentShader);
- ScopedPointer<OpenGLShaderProgram> shader;
- ScopedPointer<Shape> shape;
- ScopedPointer<Attributes> attributes;
- ScopedPointer<Uniforms> uniforms;
- OpenGLContext openGLContext;
- OpenGLTexture texture;
- DemoTexture* textureToUse, *lastTexture;
- String newVertexShader, newFragmentShader;
- CodeDocument vertexDocument, fragmentDocument;
- float scale, rotationSpeed;
- float rotation;
- Draggable3DOrientation draggableOrientation;
- BackgroundStar stars[3];
- bool doBackgroundDrawing;
- OwnedArray<DemoTexture> textures;
- BouncingNumber bouncingNumber;
- ScopedPointer<OpenGLShaderProgram::Attribute> position, normal, sourceColour, textureCoordIn;
- //HeadAnimation& demo;
- //[/UserVariables]
- //==============================================================================
- //==============================================================================
- JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HeadAnimation)
- };
- //[EndFile] You can add extra defines here...
- //[/EndFile]
- #endif // __JUCE_HEADER_F4EEA1EAFD405FD4__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement