This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Goal: rotate mask so it stays centered on the X. | |
What happens: it rotates and shifts, as if the origin of the coordinate system is | |
not at the center of the window. | |
""" | |
import numpy as np | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
from direct.gui.OnscreenText import OnscreenText #for binocular stim | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Want to combine (CMModulate) two texture stages from two cards, | |
but am just seeing the top card's texture stage. | |
""" | |
import numpy as np | |
from scipy import signal #for grating (square wave) | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
from panda3d.core import TransparencyAttrib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
def rgb_texture_byte(texture_size = 512, rgb = (0, 0, 0)): | |
""" Return Could just set card's bg color but this has other uses.""" | |
if not (all([x >= 0 for x in rgb]) and all([x <= 255 for x in rgb])): | |
raise ValueError("rgb values must lie in [0,255]") | |
rgb_texture = np.zeros((texture_size, texture_size, 3), dtype = np.uint8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def get_dpi(screen_num = 0): | |
"""Calculate the dpi of a given monitor, sensitive to | |
scaling factors they have set.""" | |
from PyQt5.QtWidgets import QApplication | |
app = QApplication(sys.argv) | |
screen = app.screens()[screen_num] | |
dpi = screen.physicalDotsPerInch() | |
app.quit() | |
return dpi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage, TransparencyAttrib | |
import numpy as np | |
from direct.gui.OnscreenText import OnscreenText | |
from direct.task import Task | |
#Create sin | |
texSize = 512 | |
frequency = 8 | |
def sin3d(X, freq = 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TransparencyAttrib | |
import numpy as np | |
#Create texture | |
texSize = 512 | |
frequency = 8 | |
def sin3d(X, freq = 1): | |
return np.sin(X*freq) | |
def sin8bit(X, freq = 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Trying to get repeated texture | |
""" | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker | |
import numpy as np | |
#Create texture | |
texSize = 64 | |
texture = 210*np.ones((texSize, texSize), dtype = np.uint8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Want the sine texture to be a little square inside the card, with noise texture filling the card. | |
""" | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
from direct.gui.OnscreenText import OnscreenText | |
import numpy as np | |
#Create matrices for textures | |
#sin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
panda3d learning | |
Exploring default scene graphs rooted with render, render2d, pixel2d | |
""" | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, NodePath #, PTAUchar, | |
import numpy as np | |
#Create random numpy array | |
size = 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Working version of calculator from Chapter 6 of stroustrup | |
//Contains way too many print statements so you can track what is going on. | |
//Each grammatical rule, and main, is annotated with attempt to explain what is happening. | |
//Note I prefer to use '#' instead of '8' to represent numbers because I'm not a monster (see: Stroop effect). | |
#include "std_lib_facilities.h" | |
//------------------------------------------------------------------------------ | |
class Token { |